16 import(
'lib.pkp.classes.plugins.Plugin');
28 abstract function executeCLI($scriptName, &$args);
34 abstract function usage($scriptName);
40 $dispatcher =
$request->getDispatcher();
41 import(
'lib.pkp.classes.linkAction.request.RedirectAction');
48 null,
'management',
'importexport', array(
'plugin', $this->
getName())
50 __(
'manager.importExport'),
54 parent::getActions(
$request, $actionArgs)
65 $templateMgr->registerPlugin(
'function',
'plugin_url', array($this,
'pluginUrl'));
67 $templateMgr->assign([
71 'name' => __(
'navigation.tools'),
75 'id' => $this->getPluginPath(),
76 'name' => $this->getDisplayName()
79 'pageTitle' => $this->getDisplayName(),
91 $dispatcher = $this->_request->getDispatcher();
92 return $dispatcher->url($this->_request, ROUTE_PAGE,
null,
'management',
'importexport', array_merge(array(
'plugin', $this->
getName(), isset($params[
'path'])?$params[
'path']:array())));
103 if ($url[0] ==
'/')
return false;
113 $allowedPrefixes = array(
119 foreach ($allowedPrefixes as $prefix) {
120 if (substr($url, 0, strlen($prefix)) === $prefix)
return true;
149 function getExportFileName($basePath, $objectsFileNamePart, $context, $extension =
'.xml') {
150 return $basePath . $this->
getPluginSettingsPrefix() .
'-' . date(
'Ymd-His') .
'-' . $objectsFileNamePart .
'-' . $context->getId() . $extension;
160 if (defined(
'SESSION_DISABLE_INIT')) {
161 echo __(
'plugins.importexport.common.validationErrors') .
"\n";
162 foreach ($errors as $error) {
163 echo trim($error->message) .
"\n";
165 libxml_clear_errors();
166 echo __(
'plugins.importexport.common.invalidXML') .
"\n";
170 header(
'Content-type: text/html; charset=' . $charset);
172 echo
'<h2>' . __(
'plugins.importexport.common.validationErrors') .
'</h2>';
173 foreach ($errors as $error) {
174 echo
'<p>' . trim($error->message) .
'</p>';
176 libxml_clear_errors();
177 echo
'<h3>' . __(
'plugins.importexport.common.invalidXML') .
'</h3>';
178 echo
'<p><pre>' . htmlspecialchars($xml) .
'</pre></p>';
179 echo
'</body></html>';
181 fatalError(__(
'plugins.importexport.common.error.validation'));