1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
$project = elgg_extract('entity', $vars); |
4
|
|
|
|
5
|
|
|
$time_created = $project->getLatestRelease()->time_created; |
6
|
|
|
|
7
|
|
|
$not_compatible = function() use ($project) { |
8
|
|
|
// Get the latest Elgg version |
9
|
|
|
$latest_elgg = array_shift(elgg_get_config('elgg_versions')); |
|
|
|
|
10
|
|
|
|
11
|
|
|
// Check if there is a release compatible with latest Elgg |
12
|
|
|
$version_found = $project->getRecentReleaseByElggVersion($latest_elgg); |
13
|
|
|
|
14
|
|
|
return $version_found ? false : true; |
15
|
|
|
}; |
16
|
|
|
|
17
|
|
|
$year = 60 * 60 * 24 * 365; |
18
|
|
|
$seconds_ago = time() - $time_created; |
19
|
|
|
$years_ago = (int) floor($seconds_ago / $year); |
20
|
|
|
|
21
|
|
|
if ($years_ago > 2 && $not_compatible()) { |
22
|
|
|
$warning = elgg_echo('plugins:project:outdated_warning', array($years_ago)); |
23
|
|
|
|
24
|
|
|
$help = elgg_echo('plugins:project:help'); |
25
|
|
|
|
26
|
|
|
$messages = array(); |
27
|
|
|
|
28
|
|
|
// Link to the code repository |
29
|
|
|
if ($project->repo) { |
30
|
|
|
$pr_quide_link = elgg_view('output/url', array( |
31
|
|
|
'href' => 'https://help.github.com/articles/using-pull-requests/', |
32
|
|
|
'text' => elgg_echo('plugins:project:pull_request'), |
33
|
|
|
)); |
34
|
|
|
|
35
|
|
|
$repo_link = elgg_view('output/url', array( |
36
|
|
|
'href' => $project->repo, |
37
|
|
|
'text' => elgg_echo('plugins:project:repo'), |
38
|
|
|
)); |
39
|
|
|
|
40
|
|
|
$messages[] = elgg_echo('plugins:project:collaborate', array($pr_quide_link, $repo_link)); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
// Link to form for requesting project ownership |
44
|
|
|
$ownership_form_link = elgg_view('output/url', array( |
45
|
|
|
'href' => "plugins/{$project->guid}/ownership_request", |
46
|
|
|
'text' => elgg_echo('plugins:project:request'), |
47
|
|
|
)); |
48
|
|
|
$messages[] = elgg_echo('plugins:project:request_ownership', array($ownership_form_link)); |
49
|
|
|
|
50
|
|
|
$suggestions = ''; |
51
|
|
|
foreach ($messages as $message) { |
52
|
|
|
$suggestions .= "<li>$message</li>"; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
echo <<<HTML |
56
|
|
|
<div class="elgg-box-error elgg-plugin-warning elgg-output mbl"> |
57
|
|
|
<p>$warning</p> |
58
|
|
|
<p>$help</p> |
59
|
|
|
<ul>$suggestions</ul> |
60
|
|
|
</div> |
61
|
|
|
HTML; |
62
|
|
|
} |
63
|
|
|
|