aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-01-04 14:25:46 +0000
committerMario <mario@mariovavti.com>2023-01-04 14:25:46 +0000
commite16ea1ae0568238fa4c2236d1f050ef4a85749c7 (patch)
tree950f23a52ad95d46b2f4cb46d821850b5c347740 /Zotlabs
parent941135a0a63d72d6300ab93a608cd5c8354d9e0a (diff)
downloadvolse-hubzilla-e16ea1ae0568238fa4c2236d1f050ef4a85749c7.tar.gz
volse-hubzilla-e16ea1ae0568238fa4c2236d1f050ef4a85749c7.tar.bz2
volse-hubzilla-e16ea1ae0568238fa4c2236d1f050ef4a85749c7.zip
pdl editor for addon iitial commit
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Pdledit.php37
-rw-r--r--Zotlabs/Module/Pdledit_gui.php42
-rw-r--r--Zotlabs/Widget/Categories.php2
3 files changed, 74 insertions, 7 deletions
diff --git a/Zotlabs/Module/Pdledit.php b/Zotlabs/Module/Pdledit.php
index 3b94c9611..e0bbc31d0 100644
--- a/Zotlabs/Module/Pdledit.php
+++ b/Zotlabs/Module/Pdledit.php
@@ -78,6 +78,23 @@ class Pdledit extends Controller {
}
}
+ // addons
+ $o .= '<h2>Addons</h2>';
+
+ $addons = plugins_installed_list();
+
+ foreach ($addons as $addon) {
+
+ $path = 'addon/' . $addon . '/Mod_' . ucfirst($addon) . '.php';
+
+ if (!file_exists($path))
+ continue;
+
+ $o .= '<a href="pdledit/' . $addon . '" >' . $addon . '</a>' . ((in_array($addon, $edited)) ? ' ' . t('(modified)') . ' <a href="pdledit/' . $addon . '/reset" >' . t('Reset') . '</a>': '' ) . '<br />';
+
+ }
+
+
$o .= '</div>';
// list module pdl files
@@ -85,11 +102,25 @@ class Pdledit extends Controller {
}
$t = get_pconfig(local_channel(),'system',$module);
- $s = file_get_contents(theme_include($module));
- if(! $t) {
+ $s = '';
+
+ if(!$t) {
+ $sys_path = theme_include($module);
+
+ if ($sys_path) {
+ $s = file_get_contents($sys_path);
+ }
+ else {
+ $addon_path = 'addon/' . argv(1) . '/' . $module;
+ if (file_exists($addon_path)) {
+ $s = file_get_contents($addon_path);
+ }
+ }
+
$t = $s;
}
- if(! $t) {
+
+ if(!$t) {
notice( t('Layout not found.') . EOL);
return '';
}
diff --git a/Zotlabs/Module/Pdledit_gui.php b/Zotlabs/Module/Pdledit_gui.php
index b550b92d3..d8d362831 100644
--- a/Zotlabs/Module/Pdledit_gui.php
+++ b/Zotlabs/Module/Pdledit_gui.php
@@ -237,18 +237,45 @@ class Pdledit_gui extends Controller {
}
}
+ $addons = plugins_installed_list();
+ if ($addons) {
+ foreach ($addons as $name) {
+ $path = 'addon/' . $name . '/Mod_' . ucfirst($name) . '.php';
+
+ if (!file_exists($path)) {
+ continue;
+ }
+
+ $ret .= '<div class="mb-2"><a href="pdledit_gui/' . $name . '">' . $name . '</a></div>';
+ }
+ }
+
return $ret;
}
function get_widgets($module) {
$ret = [];
+
$checkpaths = [
'Zotlabs/Widget/*.php'
];
+ $addons = plugins_installed_list();
+
+ if ($addons) {
+ foreach ($addons as $name) {
+ $path = 'addon/' . $name . '/Widget';
+
+ if (is_dir($path)) {
+ $checkpaths[] = $path . '/*.php';
+ }
+ }
+ }
+
foreach ($checkpaths as $path) {
$files = glob($path);
+
if($files) {
foreach($files as $f) {
$name = lcfirst(basename($f, '.php'));
@@ -536,12 +563,21 @@ class Pdledit_gui extends Controller {
'modified' => true
];
- $pdl_path = 'mod_' . $module . '.pdl';
+ $pdl = 'mod_' . $module . '.pdl';
+ $pdl_path = '';
- $ret['pdl'] = get_pconfig(local_channel(), 'system', $pdl_path);
+ $ret['pdl'] = get_pconfig(local_channel(), 'system', $pdl);
if(!$ret['pdl']) {
- $pdl_path = theme_include($pdl_path);
+ $pdl_path = theme_include($pdl);
+
+ if (!$pdl_path) {
+ $addon_path = 'addon/' . $module . '/' . $pdl;
+ if (file_exists($addon_path)) {
+ $pdl_path = $addon_path;
+ }
+ }
+
if ($pdl_path) {
$ret['pdl'] = file_get_contents($pdl_path);
$ret['modified'] = false;
diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php
index b0eda253b..7e6a3c6f7 100644
--- a/Zotlabs/Widget/Categories.php
+++ b/Zotlabs/Widget/Categories.php
@@ -3,7 +3,7 @@
/**
* * Name: Categories
* * Description: Display a menu with links to categories
- * * Requires: channel, articles, cards, cloud
+ * * Requires: channel, cloud
*/
namespace Zotlabs\Widget;