PluginProbe
Assistant – Every Day Productivity Apps / trunk
Assistant – Every Day Productivity Apps vtrunk
1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 1.0 All 71 releases
assistant / backend / src / Data / Transformers / PluginUpdatesTransformer.php

PluginUpdatesTransformer.php in Assistant – Every Day Productivity Apps trunk, at backend/src/Data/Transformers/PluginUpdatesTransformer.php

54 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace FL\Assistant\Data\Transformers;
5
6
7 class PluginUpdatesTransformer {
8
9 public function __invoke( \stdClass $plugin ) {
10 $update = $plugin->update;
11 $thumbnail = null;
12 $banner = null;
13
14 if ( isset( $update->icons ) ) {
15 if ( isset( $update->icons['2x'] ) ) {
16 $thumbnail = $update->icons['2x'];
17 } elseif ( isset( $update->icons['1x'] ) ) {
18 $thumbnail = $update->icons['1x'];
19 }
20 }
21
22 if ( isset( $update->banners ) ) {
23 $update->banners = (array) $update->banners;
24
25 if ( isset( $update->banners['2x'] ) ) {
26 $banner = $update->banners['2x'];
27 } elseif ( isset( $update->banners['1x'] ) ) {
28 $banner = $update->banners['1x'];
29 }
30 }
31
32 return [
33 'author' => $plugin->AuthorName,
34 'authorURI' => $plugin->AuthorURI,
35 'banner' => $banner,
36 'bannerSizes' => isset( $update->banners ) ? $update->banners : null,
37 'content' => $plugin->Description,
38 'id' => $update->plugin,
39 'meta' => $plugin->Version . ' by ' . $plugin->AuthorName,
40 'metaUpdated' => $update->new_version . ' by ' . $plugin->AuthorName,
41 'plugin' => $update->plugin,
42 'thumbnail' => $thumbnail,
43 'thumbnailSizes' => $update->icons,
44 'title' => $plugin->Name,
45 'type' => 'plugin',
46 'version' => $plugin->Version,
47 'updatedVersion' => $update->new_version,
48 'tested' => $update->tested,
49 'requiresPHP' => isset( $update->requires_php ) ? $update->requires_php : null,
50 'pluginURI' => $plugin->PluginURI,
51 ];
52 }
53 }
54