public function package() { $dir = _CALEM_DIR_ . 'custom/global/message/'; $dirObj = dir($dir); while (false !== ($file = $dirObj->read())) { if (strpos($file, '.message') === false) { continue; } //non-message file $hd = new CalemZipCustomMessageJs($file); $hd->package(); } }
public function updateMessage($fldAr) { $path = _CALEM_DIR_ . 'custom/global/message/'; $locale = ''; if (isset($fldAr['locale']) && strlen($fldAr['locale']) > 0) { $locale = '_' . $fldAr['locale']; } $file = 'custom' . $locale . '.message'; $fullPath = $path . $file; if (is_file($fullPath)) { $this->backupFile($path, $file); $data = file_get_contents($fullPath); $md = unserialize($data); } else { $md = array(); } $md[$fldAr['id']] = $fldAr['label']; //Now store file $rt = $this->storeFile($fldAr, $md, $fullPath); if ($rt['status'] != 0) { return $rt; } //Let's repackage $cm = new CalemZipCustomMessageJs($file); $cm->package(); //So this is a success return array('id' => $fldAr['id'], 'status' => 0); }