public function prepareLanguages($lang) { $config = JFactory::getConfig(); $tmp_path = $config->get('tmp_path'); $tmp_dir = uniqid('cck_'); $path = $tmp_path . '/' . $tmp_dir; $name = 'seblod2'; $filename = $lang . '_' . $name; $path_zip = $tmp_path . '/' . $filename . '.zip'; if (!$filename) { return; } // Core jimport('cck.base.install.export'); $manifest = JCckDev::fromXML(JPATH_ADMINISTRATOR . '/manifests/packages/pkg_cck.xml'); $extensions = array(); if (count(@$manifest->files->file)) { foreach ($manifest->files->file as $file) { $id = (string) $file; $id = str_replace('.zip', '', $id); if (strpos($id, 'var_cck_') !== false) { $id = 'files_' . $id; } $extensions[$id] = ''; } } $extensions['com_cck_core'] = ''; $extensions['com_cck_default'] = ''; // Admin $dest = $path . '/admin'; CCK_Export::exportLanguages(JPATH_ADMINISTRATOR . '/language/' . $lang, $dest, $lang, 'admin', 'cck', $extensions); CCK_Export::zip($dest, $path . '/cck_' . $lang . '_admin.zip'); // Site $dest = $path . '/site'; CCK_Export::exportLanguages(JPATH_SITE . '/language/' . $lang, $dest, $lang, 'site', 'cck|tpl_seb', $extensions); CCK_Export::zip($dest, $path . '/cck_' . $lang . '_site.zip'); // Manifest $package = (object) array('title' => 'SEBLOD ' . $lang, 'name' => 'cck_' . $lang, 'description' => 'SEBLOD 3.x ' . $lang . ' Language Pack - www.seblod.com'); $xml = CCK_Export::preparePackage($package); $files = $xml->addChild('files'); $file1 = $files->addChild('file', 'cck_' . $lang . '_admin.zip'); $file1->addAttribute('type', 'file'); $file1->addAttribute('src', 'administrator/language/' . $lang); $file1->addAttribute('id', 'cck_' . $lang . '_admin'); $file2 = $files->addChild('file', 'cck_' . $lang . '_site.zip'); $file2->addAttribute('type', 'file'); $file2->addAttribute('src', 'language/' . $lang); $file2->addAttribute('id', 'cck_' . $lang . '_site'); CCK_Export::clean($path); CCK_Export::createFile($path . '/pkg_cck_' . $lang . '.xml', '<?xml version="1.0" encoding="utf-8"?>' . $xml->asIndentedXML()); return CCK_Export::zip($path, $path_zip); }