Commit 1b281dcc authored by Nigel McNie's avatar Nigel McNie
Browse files

Copy smilies from tinyMCE into the export so they can be linked to.

parent 864cf577
......@@ -57,7 +57,7 @@ class PluginExportHtml extends PluginExport {
$this->rootdir = 'portfolio-for-' . preg_replace('#[^a-zA-Z0-9_-]+#', '-', $user->get('username'));
// Create basic required directories
foreach (array('files', 'views', 'static') as $directory) {
foreach (array('files', 'views', 'static', 'static/smilies') as $directory) {
$directory = "{$this->exportdir}/{$this->rootdir}/{$directory}/";
if (!check_dir_exists($directory)) {
throw new SystemException("Couldn't create the temporary export directory $directory");
......@@ -221,15 +221,23 @@ class PluginExportHtml extends PluginExport {
*/
private function copy_static_files() {
$staticdir = $this->get('exportdir') . '/' . $this->get('rootdir') . '/static/';
foreach (new RecursiveDirectoryIterator(get_config('docroot') . 'export/html/static/') as $fileinfo) {
$directoriestocopy = array(
get_config('docroot') . 'export/html/static/' => $staticdir,
get_config('docroot') . 'js/tinymce/plugins/emotions/images' => $staticdir . 'smilies/',
);
foreach ($directoriestocopy as $from => $to) {
foreach (new RecursiveDirectoryIterator($from) as $fileinfo) {
if (!$fileinfo->isFile() || substr($fileinfo->getFilename(), 0, 1) == '.') {
continue;
}
if (!copy($fileinfo->getPathname(), $staticdir . $fileinfo->getFilename())) {
if (!copy($fileinfo->getPathname(), $to . $fileinfo->getFilename())) {
throw new SystemException("Could not copy static file " . $fileinfo->getPathname());
}
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment