mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
Checksum code fixed. Added DocBlocks to D2Classes. TODO: Fill in docblocks, refactor, code cleanup
This commit is contained in:
@@ -42,11 +42,22 @@
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class D2SaveTXT {
|
||||
|
||||
public $path;
|
||||
|
||||
public function save($file, $data) {
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $path;
|
||||
|
||||
/**
|
||||
* @param $file
|
||||
* @param $data
|
||||
* @return void
|
||||
*/
|
||||
public function save($file, $data) {
|
||||
|
||||
$fp = fopen($this->path.DIRECTORY_SEPARATOR.$file, 'a+');
|
||||
$this->saveBackup($file);
|
||||
@@ -54,7 +65,11 @@ class D2SaveTXT {
|
||||
}
|
||||
|
||||
|
||||
public function saveBackup($file){
|
||||
/**
|
||||
* @param $file
|
||||
* @return void
|
||||
*/
|
||||
public function saveBackup($file){
|
||||
|
||||
// if dir doesn't exist, create it
|
||||
if (!is_dir($this->path.DIRECTORY_SEPARATOR."backup")) mkdir($this->path."backup", 0700);
|
||||
@@ -71,8 +86,12 @@ class D2SaveTXT {
|
||||
echo "Failed to create backup of $file...\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function saveTblEnries($filename) {
|
||||
|
||||
/**
|
||||
* @param $filename
|
||||
* @return void
|
||||
*/
|
||||
public function saveTblEnries($filename) {
|
||||
$post = $_POST;
|
||||
|
||||
if (!is_dir($this->path."tblEntries")) mkdir($this->path."tblEntries", 0700);
|
||||
@@ -81,9 +100,12 @@ class D2SaveTXT {
|
||||
$str = '"'.$post['index'].'"'."\t".'"'.$post['index'].'"'.PHP_EOL;
|
||||
$file = $this->path."\\tblEntries\\$filename";
|
||||
file_put_contents($file, $str, FILE_APPEND);
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->path = TXT_PATH;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user