コード例 #1
0
ファイル: cck.php プロジェクト: codigoaberto/SEBLOD
 public function prepareExport($id = 0)
 {
     $config = JFactory::getConfig();
     $tmp_path = $config->get('tmp_path');
     $tmp_dir = uniqid('cck_');
     $path = $tmp_path . '/' . $tmp_dir;
     $extension = JCckDatabase::loadObject('SELECT name, type, element, folder FROM #__extensions WHERE extension_id=' . (int) $id);
     if (!$extension) {
         return;
     }
     jimport('cck.base.install.export');
     $name = $extension->element;
     $prefix = CCK_Export::getPrefix($extension->type);
     $src = JPATH_SITE . '/plugins/' . $extension->folder . '/' . $extension->element;
     $xml = JCckDev::fromXML($src . '/' . $name . '.xml');
     $version = isset($xml->version) ? '_' . $xml->version : '';
     $filename = $prefix . '_' . $extension->folder . '_' . $name . $version;
     $path_zip = $tmp_path . '/' . $filename . '.zip';
     if (!$filename) {
         return;
     }
     if ($src && JFolder::exists($src)) {
         JFolder::copy($src, $path);
         CCK_Export::clean($path);
     }
     CCK_Export::exportLanguage($src . '/' . $name . '.xml', JPATH_ADMINISTRATOR, $path);
     CCK_Export::findFields(array($src . '/tmpl/edit.php', $src . '/tmpl/edit2.php'), $path . '/install');
     return CCK_Export::zip($path, $path_zip);
 }
コード例 #2
0
ファイル: template.php プロジェクト: codigoaberto/SEBLOD
 public function prepareExport_Variation($name, $folder)
 {
     $config = JFactory::getConfig();
     $tmp_path = $config->get('tmp_path');
     $tmp_dir = uniqid('cck_');
     $path = $tmp_path . '/' . $tmp_dir;
     $filename = 'var_cck_' . $name;
     $path_zip = $tmp_path . '/' . $filename . '.zip';
     $src = JPATH_SITE . $folder . $name;
     // Variation
     jimport('cck.base.install.export');
     if (JFolder::exists($src)) {
         JFolder::copy($src, $path . '/' . $name);
     }
     // Manifest
     $manifest = JPATH_ADMINISTRATOR . '/manifests/files/' . $filename . '.xml';
     jimport('joomla.filesystem.file');
     if (JFile::exists($manifest)) {
         JFile::copy($manifest, $path . '/' . $filename . '.xml');
     } else {
         $xml = CCK_Export::prepareFile((object) array('title' => $filename));
         $fileset = $xml->addChild('fileset');
         $files = $fileset->addChild('files');
         $files->addAttribute('target', 'libraries/cck/rendering/variations');
         $file = $files->addChild('folder', $name);
         CCK_Export::createFile($path . '/' . $filename . '.xml', '<?xml version="1.0" encoding="utf-8"?>' . $xml->asIndentedXML());
     }
     CCK_Export::clean($path);
     CCK_Export::exportLanguage($path . '/' . $filename . '.xml', JPATH_SITE, $path);
     return CCK_Export::zip($path, $path_zip);
 }
コード例 #3
0
ファイル: export.php プロジェクト: kolydart/SEBLOD
 public static function exportFile($type, &$data, $file, $extensions = array())
 {
     $path = $data['root_extensions'] . '/_temp';
     if ($file['src'] && JFolder::exists($file['src'])) {
         if ($type == 'variation' || $type == 'processing') {
             JFolder::copy($file['src'], $path . '/' . $file['name']);
             $manifest = JPATH_ADMINISTRATOR . '/manifests/files/' . $file['filename'] . '.xml';
             if (JFile::exists($manifest)) {
                 JFile::copy($manifest, $path . '/' . $file['filename'] . '.xml');
             } else {
                 $xml = CCK_Export::prepareFile((object) array('title' => $file['name']));
                 $fileset = $xml->addChild('fileset');
                 $files = $fileset->addChild('files');
                 if ($type == 'processing') {
                     $target = 'media/cck/processings';
                     if (isset($extensions[$file['src']]->src)) {
                         $target = $extensions[$file['src']]->src;
                     }
                 } else {
                     $target = 'libraries/cck/rendering/variations';
                 }
                 $files->addAttribute('target', $target);
                 $addfile = $files->addChild('folder', $file['name']);
                 CCK_Export::createFile($path . '/' . $file['filename'] . '.xml', '<?xml version="1.0" encoding="utf-8"?>' . $xml->asIndentedXML());
             }
         } else {
             JFolder::copy($file['src'], $path);
             if ($type == 'plugin') {
                 CCK_Export::findFields(array($file['src'] . '/tmpl/edit.php', $file['src'] . '/tmpl/edit2.php'), $path . '/install');
             }
         }
         if (@$file['lang_src'] != '') {
             CCK_Export::exportLanguage($file['lang_src'], $file['lang_root'], $path);
         }
         CCK_Export::clean($path);
         CCK_Export::zip($path, $data['root_extensions'] . '/' . $file['_']);
     }
 }