00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00031 class Album_XML extends Album
00032 {
00037 function loadData($file)
00038 {
00042 global $settings;
00043
00044 if (is_null($this->minixml))
00045 {
00046 $this->minixml = $settings->attribute("minixml_path");
00047 }
00048 require_once ($this->minixml."/minixml.inc.php");
00049
00050 $doc = new MiniXMLDoc();
00051 $doc->fromFile($file);
00052 $root =& $doc->getRoot();
00053
00054 $album =& $root->getElement("album");
00055 $this->id = trim($album->attribute("id"));
00056
00057
00058 for ($c = 0; $c < $album->numChildren(); $c++)
00059 {
00060 $child =& $album->xchildren[$c];
00061
00062 if ($child->name() != "photo")
00063 {
00064 $this->attributes[$child->name()] = trim($child->text());
00065 }
00066 else
00067 {
00068 $photo = trim($child->text());
00069 $this->photos[] = $photo;
00070 $this->captions[] = trim($child->attribute("caption"));
00071
00072 if (preg_match('/\.sized\./', $photo))
00073 {
00074 $this->thumbnails[] = preg_replace('/sized/', 'thumb', $photo);
00075 }
00076 else
00077 {
00078 $pi = pathinfo($photo);
00079 $s = array('/\.'.$pi['extension'].'/');
00080 $r = array(".thumb.".$pi['extension']);
00081 $thumb = preg_replace($s, $r, $pi['basename']);
00082 $this->thumbnails[] = $thumb;
00083 }
00084 }
00085 }
00086 }
00087 }
00088 ?>