1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Export path mods

This commit is contained in:
CaMer0n
2009-09-10 09:49:01 +00:00
parent 4011d77fe1
commit c1a46151c9
2 changed files with 26 additions and 7 deletions

View File

@@ -9,8 +9,8 @@
* Administration - Database Utilities * Administration - Database Utilities
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $
* $Revision: 1.30 $ * $Revision: 1.31 $
* $Date: 2009-09-06 01:02:01 $ * $Date: 2009-09-10 09:49:01 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -729,6 +729,10 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE)
$xml->convertFilePaths = TRUE; $xml->convertFilePaths = TRUE;
$xml->filePathDestination = EXPORT_PATH; $xml->filePathDestination = EXPORT_PATH;
$xml->filePathPrepend = array(
'news_thumbnail' => "{e_IMAGE}newspost_images/"
);
$desinationFolder = $tp->replaceConstants($xml->filePathDestination); $desinationFolder = $tp->replaceConstants($xml->filePathDestination);

View File

@@ -9,8 +9,8 @@
* Simple XML Parser * Simple XML Parser
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $
* $Revision: 1.23 $ * $Revision: 1.24 $
* $Date: 2009-09-06 01:02:01 $ * $Date: 2009-09-10 09:49:01 $
* $Author: e107coders $ * $Author: e107coders $
*/ */
@@ -78,6 +78,10 @@ class xmlClass
public $convertFileTypes = array("jpg","gif","png","jpeg"); public $convertFileTypes = array("jpg","gif","png","jpeg");
public $filePathPrepend = array();
public $filePathConvKeys = array();
/** /**
* Add root element to the result array * Add root element to the result array
@@ -144,8 +148,13 @@ class xmlClass
* *
*/ */
function __constructor() function __constructor()
{ {
$this->reset(); $this->reset();
if(count($this->filePathConversions))
{
$this->filePathConvKeys = array_keys($this->filePathConversions);
}
} }
/** /**
@@ -563,10 +572,16 @@ class xmlClass
/** /**
* Process data values for XML file. If $this->convertFilePaths is TRUE, convert paths - see replaceFilePaths() * Process data values for XML file. If $this->convertFilePaths is TRUE, convert paths - see replaceFilePaths()
* @param mixed $val * @param mixed $val
* @param string $key key for the current value. Used for exception processing.
* @return mixed * @return mixed
*/ */
private function e107ExportValue($val) private function e107ExportValue($val,$key='')
{ {
if($key && isset($this->filePathPrepend[$key]))
{
$val = $this->filePathPrepend[$key].$val;
}
if($this->convertFilePaths) if($this->convertFilePaths)
{ {
$types = implode("|",$this->convertFileTypes); $types = implode("|",$this->convertFileTypes);
@@ -633,7 +648,7 @@ class xmlClass
$text .= "\t\t<item>\n"; $text .= "\t\t<item>\n";
foreach($row as $key=>$val) foreach($row as $key=>$val)
{ {
$text .= "\t\t\t<field name='".$key."'>".$this->e107ExportValue($val)."</field>\n"; $text .= "\t\t\t<field name='".$key."'>".$this->e107ExportValue($val,$key)."</field>\n";
} }
$text .= "\t\t</item>\n"; $text .= "\t\t</item>\n";