Skip to content

Commit 6c5ee06

Browse files
committed
Merge branch 'develop' into 'main'
Release: develop into main for v6 release See merge request 2pisoftware/cosine/core!407
2 parents 4007c5c + 46d2f6f commit 6c5ee06

File tree

208 files changed

+9616
-5937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+9616
-5937
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ jobs:
8484
CORE_BRANCH: "${{ github.event.pull_request.head.ref || github.ref_name }}"
8585
run: |
8686
# Link system dir
87+
cd core
88+
git status
89+
cd ..
8790
cd boilerplate
8891
ln -s ../core/system system
8992
@@ -174,7 +177,7 @@ jobs:
174177
docker cp cmfive:/var/www/html/system/templates/base /tmp/cmfive-theme
175178
cd /tmp/cmfive-theme
176179
npm ci || npm install
177-
npm run production
180+
npm run prod
178181
# Copy the compiled theme back to the docker container
179182
docker cp /tmp/cmfive-theme/. cmfive:/var/www/html/system/templates/base
180183

.github/workflows/theme.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: npm install
2828
- name: Build
2929
working-directory: ./system/templates/base
30-
run: npm run production
30+
run: npm run prod
3131
- name: Save artifact
3232
uses: actions/upload-artifact@v4
3333
with:

system/classes/Config.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public static function set($key, $value)
9090
* key out of the array
9191
*
9292
* @param string $key
93-
* @return Mixed the value
93+
* @return mixed the value
9494
*/
9595
public static function get($key, $default = null)
9696
{
@@ -234,6 +234,15 @@ public static function setSandbox($shadow_register = [])
234234
{
235235
self::$shadow_register = $shadow_register;
236236
}
237+
238+
public static function promoteSandbox()
239+
{
240+
if (self::isSandboxing()) {
241+
if (!empty(self::$register)) {
242+
self::$shadow_register = array_merge(self::$shadow_register, self::$register);
243+
}
244+
}
245+
}
237246

238247
public static function mergeSandbox()
239248
{
@@ -475,8 +484,8 @@ public static function registerModule($module, $config, $include_path)
475484
/**
476485
* Searches the dependency stack for a registered module
477486
*
478-
* @param String $module
479-
* @return Mixed registered module
487+
* @param string $module
488+
* @return string|null registered module
480489
*/
481490
public static function getRegisteredModule($module)
482491
{
@@ -496,9 +505,6 @@ public static function getRegisteredModule($module)
496505
public static function load()
497506
{
498507
if (!empty(self::$dependency_stack)) {
499-
// Remove - testing graph capabilities by randomising the load order of modules
500-
shuffle(self::$dependency_stack);
501-
502508
foreach (self::$dependency_stack as $node) {
503509
self::visitNode($node);
504510
}

system/classes/DbService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function clearCache()
144144
*
145145
* @param string $table
146146
* @param scalar|array $idOrWhere
147-
* @return $class|null
147+
* @return DbObject|null
148148
*/
149149
public function getObject($class, $idOrWhere, $use_cache = true, $order_by = null, $includeDeleted = false)
150150
{

system/classes/HtmlBootstrap5.php

Lines changed: 66 additions & 46 deletions
Large diffs are not rendered by default.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
interface InjectableModuleInterface
4+
{
5+
/**
6+
* This function should return a fake Config array that will be used to inject the module into the top menu.
7+
* The injected_by key should be the name of the module that is injecting this module and is required for
8+
* ensuring that the autoloader can find the right folder for autoloaded classes
9+
*
10+
* E.g.
11+
* ```php
12+
* return [
13+
* 'path' => 'modules',
14+
* 'active' => true,
15+
* 'topmenu' => 'Injected Module',
16+
* 'injected_by' => 'my_parent_module',
17+
* ];
18+
* ```
19+
* @return array
20+
*/
21+
public static function serviceConfig(): array;
22+
23+
/**
24+
* This function should inspect the parsed Web path and determine if the current request is in the injected top level module.
25+
* This is primarily used to ensure that the correct top level menu item is highlighted correctly.
26+
*
27+
* E.g.
28+
* ```php
29+
* return $w->_module == "parent_module" && in_array($w->_submodule, ['injected_submodule1', 'injected_submodule2']);
30+
* ```
31+
* @param Web $w
32+
* @return bool
33+
*/
34+
public static function isInInjectedTopLevelModule(Web $w): bool;
35+
36+
/**
37+
* MenuLink is needed as the Web version of the menuLink function makes checks to Auth allowed functions that interfere with display
38+
*
39+
* E.g.
40+
* ```php
41+
* return HtmlBootstrap5::a("/my-module/target_action", "My Injected Module", null, 'nav-link');
42+
* ```
43+
* @return string
44+
*/
45+
public function menuLink(): string;
46+
}

system/classes/MenuLinkStruct.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
22

3-
class MenuLinkStruct {
3+
class MenuLinkStruct
4+
{
45
public function __construct(
56
public string $title,
67
public string $url,
78
public MenuLinkType $type = MenuLinkType::Link,
89
) {
910
if ($url[0] !== '/') {
10-
$this->url = '/' . $url;
11+
$this->url = '/'.$url;
1112
}
1213
}
1314
}

system/classes/Request.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,28 @@ public static function hasAll(string ...$keys): bool
156156

157157
return true;
158158
}
159+
160+
/**
161+
* Returns an array of all the parameters in the $_REQUEST superglobal. If a
162+
* predicate is supplied, only the parameters that pass the predicate will be
163+
* returned.
164+
*
165+
* @param callable|null $predicate
166+
* @return array
167+
*/
168+
public static function params(callable $predicate = null): array
169+
{
170+
if (empty($predicate)) {
171+
return $_REQUEST;
172+
}
173+
174+
$params = [];
175+
foreach ($_REQUEST as $key => $value) {
176+
if ($predicate($key, $value)) {
177+
$params[$key] = $value;
178+
}
179+
}
180+
181+
return $params;
182+
}
159183
}

system/classes/html/cmfive/CodeMirrorEditor.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,9 @@ public function setValues(array $values): self
4343
$this->_values = $values;
4444
return $this;
4545
}
46-
/*
47-
public function __toString(): string
48-
{
49-
if (!empty($this->_values)) {
50-
$this->_config['items'] = $this->_values;
51-
}
52-
$this->setAttribute('data-config', json_encode($this->_config));
53-
$this->class = $this->class .= ' code-mirror-target';
5446

55-
return parent::__toString();
56-
}
57-
*/
5847
public function __toString()
5948
{
6049
return '<textarea name="' . $this->name . '" id="' . $this->id . '" style="display:none"></textarea><div class="code-mirror-target" cm-value=\'' . $this->value . '\' id="' . $this->id . '">' . '</div>';
6150
}
62-
6351
}

system/classes/html/cmfive/QuillEditor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ class QuillEditor extends \Html\Form\InputField
1212

1313
public $options = ["theme" => "snow"];
1414

15+
/**
16+
* Value of the textarea
17+
* @var string
18+
*/
19+
public $value;
20+
1521
/**
1622
* Sets the options to use for Quill
1723
*
@@ -25,6 +31,6 @@ public function setOptions(array $options = []): self
2531

2632
public function __toString()
2733
{
28-
return '<textarea name="' . $this->name . '" id="' . $this->id . '" style="display:none"></textarea><div class="quill-editor" data-quill-options=\'' . json_encode($this->options, JSON_FORCE_OBJECT) . '\' id="quill_' . $this->id . '">' . $this->value . '</div>';
34+
return '<textarea name="' . $this->name . '" id="' . $this->id . '" style="display:none">' . $this->value . '</textarea><div class="quill-editor" data-quill-options=\'' . json_encode($this->options, JSON_FORCE_OBJECT) . '\' id="quill_' . $this->id . '">' . $this->value . '</div>';
2935
}
3036
}

0 commit comments

Comments
 (0)