-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.php
54 lines (39 loc) · 1.63 KB
/
theme.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Bootstrap Blog
*/
use Atomastic\Arrays\Arrays;
use Atomastic\Macroable\Macroable;
Arrays::macro('onlyFromCollection', function(array $keys) {
$result = [];
foreach ($this->toArray() as $key => $value) {
$result[$key] = arrays($value)->only($keys)->toArray();
}
return arrays($result);
});
Arrays::macro('exceptFromCollection', function(array $keys) {
$result = [];
foreach ($this->toArray() as $key => $value) {
$result[$key] = arrays($value)->except($keys)->toArray();
}
return arrays($result);
});
$blogCollectionCacheID = strings('blog-collection-' . flextype('registry')
->get('themes.bootstrap-blog.settings.blog_id'))
->hash()
->toString();
flextype('emitter')->addListener('onEntriesCreate', function () use ($blogCollectionCacheID) {
flextype('cache')->delete($blogCollectionCacheID);
});
flextype('emitter')->addListener('onEntriesDelete', function () use ($blogCollectionCacheID) {
flextype('cache')->delete($blogCollectionCacheID);
});
flextype('emitter')->addListener('onEntriesCopy', function () use ($blogCollectionCacheID) {
flextype('cache')->delete($blogCollectionCacheID);
});
flextype('emitter')->addListener('onEntriesMove', function () use ($blogCollectionCacheID) {
flextype('cache')->delete($blogCollectionCacheID);
});
flextype('emitter')->addListener('onEntriesUpdate', function () use ($blogCollectionCacheID) {
flextype('cache')->delete($blogCollectionCacheID);
});