TYPO3 API  SVNRelease
class.tx_em_parser_mirrorxmlabstractparser.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2010 Marcus Krause <marcus#exp2010@t3sec.info>
00006  *         Steffen Kamper <info@sk-typo3.de>
00007  *  All rights reserved
00008  *
00009  *  This script is part of the TYPO3 project. The TYPO3 project is
00010  *  free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  The GNU General Public License can be found at
00016  *  http://www.gnu.org/copyleft/gpl.html.
00017  *
00018  *  This script is distributed in the hope that it will be useful,
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *  GNU General Public License for more details.
00022  *
00023  *  This copyright notice MUST APPEAR in all copies of the script!
00024  ***************************************************************/
00025 /**
00026  * class.tx_em_parser_mirrorxmlabstractparser.php
00027  *
00028  * Module: Extension manager - mirror.xml abstract parser
00029  *
00030  * $Id: class.tx_em_parser_mirrorxmlabstractparser.php 1913 2010-02-21 15:47:37Z mkrause $
00031  *
00032  * @author  Marcus Krause <marcus#exp2010@t3sec.info>
00033  * @author  Steffen Kamper <info@sk-typo3.de>
00034  */
00035 
00036 
00037 /**
00038  * Abstract parser for TYPO3's mirror.xml file.
00039  *
00040  * @author    Marcus Krause <marcus#exp2010@t3sec.info>
00041  * @author    Steffen Kamper <info@sk-typo3.de>
00042  *
00043  * @since      2010-02-09
00044  * @package  TYPO3
00045  * @subpackage  EM
00046  */
00047 abstract class tx_em_Parser_MirrorXmlAbstractParser extends tx_em_Parser_XmlAbstractParser {
00048 
00049 
00050     /**
00051      * Keeps country of currently processed mirror.
00052      *
00053      * @var  string
00054      */
00055     protected $country = NULL;
00056 
00057     /**
00058      * Keeps hostname of currently processed mirror.
00059      *
00060      * @var  string
00061      */
00062     protected $host = NULL;
00063 
00064     /**
00065      * Keeps path to mirrored TER of currently processed mirror.
00066      *
00067      * @var  string
00068      */
00069     protected $path = NULL;
00070 
00071     /**
00072      * Keeps sponsor link of currently processed mirror.
00073      *
00074      * @var  string
00075      */
00076     protected $sponsorlink = NULL;
00077 
00078     /**
00079      * Keeps sponsor logo location of currently processed mirror.
00080      *
00081      * @var  string
00082      */
00083     protected $sponsorlogo = NULL;
00084 
00085     /**
00086      * Keeps sponsor name of currently processed mirror.
00087      *
00088      * @var  string
00089      */
00090     protected $sponsorname = NULL;
00091 
00092     /**
00093      * Keeps title of currently processed mirror.
00094      *
00095      * @var  string
00096      */
00097     protected $title = NULL;
00098 
00099 
00100     /**
00101      * Returns an assoziative array of all mirror properties.
00102      *
00103      * Valid array keys of returned array are:
00104      * country, host, path, sponsorlink, sponsorlogo, sponsorname, title
00105      *
00106      * @access  public
00107      * @return  array  assoziative array of a mirror's properties
00108      * @see  $country, $host, $path, $sponsorlink, $sponsorlogo, $sponsorname, $title
00109      */
00110     public function getAll() {
00111         $mirrorProperties = array();
00112         $mirrorProperties['title'] = $this->title;
00113         $mirrorProperties['host'] = $this->host;
00114         $mirrorProperties['path'] = $this->path;
00115         $mirrorProperties['country'] = $this->country;
00116         $mirrorProperties['sponsorname'] = $this->sponsorname;
00117         $mirrorProperties['sponsorlink'] = $this->sponsorlink;
00118         $mirrorProperties['sponsorlogo'] = $this->sponsorlogo;
00119         return $mirrorProperties;
00120     }
00121 
00122     /**
00123      * Returns country of currently processed mirror.
00124      *
00125      * @access  public
00126      * @return  string  name of country a mirror is located in
00127      * @see  $country, getAll()
00128      */
00129     public function getCountry() {
00130         return $this->country;
00131     }
00132 
00133     /**
00134      * Returns host of currently processed mirror.
00135      *
00136      * @access  public
00137      * @return  string  host name
00138      * @see  $host, getAll()
00139      */
00140     public function getHost() {
00141         return $this->host;
00142     }
00143 
00144     /**
00145      * Returns path to mirrored TER of currently processed mirror.
00146      *
00147      * @access  public
00148      * @return  string  path name
00149      * @see  $path, getAll()
00150      */
00151     public function getPath() {
00152         return $this->path;
00153     }
00154 
00155     /**
00156      * Returns sponsor link of currently processed mirror.
00157      *
00158      * @access  public
00159      * @return  string  URL of a sponsor's website
00160      * @see  $sponsorlink, getAll()
00161      */
00162     public function getSponsorlink() {
00163         return $this->sponsorlink;
00164     }
00165 
00166     /**
00167      * Returns sponsor logo location of currently processed mirror.
00168      *
00169      * @access  public
00170      * @return  string  a sponsor's logo location
00171      * @see  $sponsorlogo, getAll()
00172      */
00173     public function getSponsorlogo() {
00174         return $this->sponsorlogo;
00175     }
00176 
00177     /**
00178      * Returns sponsor name of currently processed mirror.
00179      *
00180      * @access  public
00181      * @return  string  name of sponsor
00182      * @see  $sponsorname, getAll()
00183      */
00184     public function getSponsorname() {
00185         return $this->sponsorname;
00186     }
00187 
00188     /**
00189      * Returns title of currently processed mirror.
00190      *
00191      * @access  public
00192      * @return  string  title of mirror
00193      * @see  $title, get All()
00194      */
00195     public function getTitle() {
00196         return $this->title;
00197     }
00198 
00199     /**
00200      * Method resets version class properties.
00201      *
00202      * @access  protected
00203      * @return  void
00204      * @see  $country, $host, $path, $sponsorlink, $sponsorlogo, $sponsorname, $title
00205      */
00206     protected function resetProperties() {
00207         $this->title = $this->host = $this->path =
00208                 $this->country = $this->sponsorname = $this->sponsorlink =
00209                         $this->sponsorlogo;
00210     }
00211 
00212     /**
00213      * Method provides a wrapper for an exception call
00214      *
00215      * @access  protected
00216      * @param   string   $message  the exception message to throw.
00217      * @param   integer $code  the exception code.
00218      * @return  void
00219      */
00220     protected function throwException($message = "", $code = 0) {
00221         throw new tx_em_MirrorXmlException(get_class($this) . ': ' . $message, $code);
00222     }
00223 }
00224 
00225 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/parser/class.tx_em_parser_mirrorxmlabstractparser.php'])) {
00226     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/parser/class.tx_em_parser_mirrorxmlabstractparser.php']);
00227 }
00228 
00229 ?>