本文整理汇总了PHP中FArrayHelper::extract方法的典型用法代码示例。如果您正苦于以下问题:PHP FArrayHelper::extract方法的具体用法?PHP FArrayHelper::extract怎么用?PHP FArrayHelper::extract使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FArrayHelper
的用法示例。
在下文中一共展示了FArrayHelper::extract方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
/**
* Export the package
*
* @param array $ids package ids to export
*
* @return void
*/
public function export($ids = array())
{
jimport('joomla.filesystem.archive');
foreach ($ids as $id) {
$row = $this->getTable();
$row->load($id);
$this->outputPath = JPATH_ROOT . '/tmp/' . $this->getComponentName($row) . '/';
$json = $row->params;
$row->params = json_decode($row->params);
$row->blocks = $row->params->canvas->blocks;
$componentZipPath = $this->outputPath . 'packages/com_' . $this->getComponentName($row) . '.zip';
$pkgName = 'pkg_' . $this->getComponentName($row, true) . '.zip';
$packageZipPath = $this->outputPath . $pkgName;
if (JFile::exists($componentZipPath)) {
JFile::delete($componentZipPath);
}
$filenames = array();
$row2 = clone $row;
$row2->params = $json;
$filenames[] = $this->makeInstallSQL($row);
$filenames[] = $this->makeUnistallSQL($row);
$filenames[] = $this->makeXML($row);
$filenames[] = $this->makeComponentManifestClass($row2);
$this->copySkeleton($row, $filenames);
$this->alterViewXML($row);
$archive = JArchive::getAdapter('zip');
$files = array();
$this->addFiles($filenames, $files, $this->outputPath);
$ok = $archive->create($componentZipPath, $files);
if (!$ok) {
throw new RuntimeException('Unable to create component zip in ' . $componentZipPath, 500);
}
// Make form module
$archive = JArchive::getAdapter('zip');
$formModuleFiles = $this->formModuleFiles($row);
$formModuleZipPath = $this->outputPath . 'packages/mod_' . $this->getComponentName($row) . '_form.zip';
$ok = $archive->create($formModuleZipPath, $formModuleFiles);
if (!$ok) {
throw new RuntimeException('Unable to form module zip in ' . $componentZipPath, 500);
}
// Copy that to root
$ok = JFile::copy($componentZipPath, $this->outputPath . 'com_' . $this->getComponentName($row) . '.zip');
// Now lets create the Joomla install package
$plugins = $this->findPlugins($row);
$this->zipPlugins($row, $plugins);
$filenames = FArrayHelper::extract($plugins, 'fullfile');
$filenames[] = $componentZipPath;
// Have to add this LAST to filenames
$filenames[] = $this->makePackageXML($row, $plugins);
$files = array();
$this->addFiles($filenames, $files, $this->outputPath);
$ok = $archive->create($packageZipPath, $files);
if (!$ok) {
throw new RuntimeException('Unable to create zip in ' . $componentZipPath, 500);
}
// $this->triggerDownload($pkgName, $packageZipPath);
// $this->cleanUp($pkgName);
}
}
示例2: export
public function export($ids = array())
{
//JModel::addIncludePath(COM_FABRIK_FRONTEND.DS.'models');
jimport('joomla.filesystem.archive');
foreach ($ids as $id) {
$row = $this->getTable();
$row->load($id);
$this->outputPath = JPATH_ROOT . DS . 'tmp' . DS . $this->getComponentName($row);
$json = $row->params;
$row->params = json_decode($row->params);
$row->blocks = $row->params->canvas->blocks;
$componentZipPath = $this->outputPath . DS . 'packages' . DS . 'com_' . $this->getComponentName($row) . '.zip';
$pkgName = 'pkg_' . $this->getComponentName($row) . '.zip';
$packageZipPath = $this->outputPath . DS . $pkgName;
if (JFile::exists($componentZipPath)) {
JFile::delete($componentZipPath);
}
$filenames = array();
$row2 = clone $row;
$row2->params = $json;
$filenames[] = $this->makeXML($row);
$filenames[] = $this->makeInstallSQL($row);
$filenames[] = $this->makeUnistallSQL($row);
$filenames[] = $this->makeMetaSQL($row2);
$this->copySkeleton($row, $filenames);
$archive = JArchive::getAdapter('zip');
$files = array();
$this->addFiles($filenames, $files, $this->outputPath . DS);
$ok = $archive->create($componentZipPath, $files);
if (!$ok) {
JError::raiseError(500, 'Unable to create zip in ' . $componentZipPath);
}
//copy that to root
$ok = JFile::copy($componentZipPath, $this->outputPath . DS . 'com_' . $this->getComponentName($row) . '.zip');
// now lets create the Joomla install package
$plugins = $this->findPlugins($row);
$this->zipPlugins($row, $plugins);
$filenames = FArrayHelper::extract($plugins, 'fullfile');
$filenames[] = $componentZipPath;
$filenames[] = $this->makePackageXML($row, $plugins);
$files = array();
$this->addFiles($filenames, $files, $this->outputPath . DS);
$ok = $archive->create($packageZipPath, $files);
if (!$ok) {
JError::raiseError(500, 'Unable to create zip in ' . $componentZipPath);
}
//$this->triggerDownload($pkgName, $packageZipPath);
//$this->cleanUp($pkgName);
}
}