aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-07-17 16:05:26 -0400
committerAndrew Manning <tamanning@zoho.com>2016-07-17 16:05:26 -0400
commitd6b28cdc575aba40c6a7861d4c2031d844a848d9 (patch)
treecf5ff33140d95189d0958af8882c69b08ac99d6a /Zotlabs
parent75fb065526d11714c1c0fd8a4b6f94dea65674ae (diff)
downloadvolse-hubzilla-d6b28cdc575aba40c6a7861d4c2031d844a848d9.tar.gz
volse-hubzilla-d6b28cdc575aba40c6a7861d4c2031d844a848d9.tar.bz2
volse-hubzilla-d6b28cdc575aba40c6a7861d4c2031d844a848d9.zip
Importing webpage elements from manually entered cloud file path work. All detected elements are automatically imported.
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Webpages.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php
index e85c49b44..9a79478a9 100644
--- a/Zotlabs/Module/Webpages.php
+++ b/Zotlabs/Module/Webpages.php
@@ -269,9 +269,28 @@ class Webpages extends \Zotlabs\Web\Controller {
notice( t('Invalid folder path.') . EOL);
return null;
}
- info( t('Valid folder path.') . EOL);
-
+ require_once('include/import.php');
+ $elements = [];
+ $elements['pages'] = scan_webpage_elements($_POST['path'], 'page', true);
+ $elements['layouts'] = scan_webpage_elements($_POST['path'], 'layout', true);
+ $elements['blocks'] = scan_webpage_elements($_POST['path'], 'block', true);
+ logger('elements: ' . json_encode($elements));
+ if(!(empty($elements['pages']) && empty($elements['blocks']) && empty($elements['layouts']))) {
+ info( t('Webpages elements detected.') . EOL);
+ }
+ // Import layout first so that pages that reference new layouts will find
+ // the mid of layout items in the database
+ foreach($elements['layouts'] as &$layout) {
+ $layout = import_webpage_element($layout, $channel, 'layout');
+ }
+ foreach($elements['pages'] as &$page) {
+ $page = import_webpage_element($page, $channel, 'page');
+ }
+ foreach($elements['blocks'] as &$block) {
+ $block = import_webpage_element($block, $channel, 'block');
+ }
+
return null;