-
Notifications
You must be signed in to change notification settings - Fork 7
/
install.jw_disqus.php
82 lines (77 loc) · 2.71 KB
/
install.jw_disqus.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* @version 3.7.0
* @package Disqus Comments (for Joomla)
* @author JoomlaWorks - https://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2018 JoomlaWorks Ltd. All rights reserved.
* @license https://www.joomlaworks.net/license
*/
// no direct access
defined('_JEXEC') or die ;
if (version_compare(JVERSION, '1.6.0', 'lt')) {
jimport('joomla.installer.installer');
$app = JFactory::getApplication();
$db = JFactory::getDBO();
// Load language file
$lang = JFactory::getLanguage();
$lang->load('com_jw_disqus');
// Set some variables
$status = new stdClass;
$src = $this->parent->getPath('source');
// Install plugins
$plugins = $this->manifest->getElementByPath('plugins');
if (is_a($plugins, 'JSimpleXMLElement') && count($plugins->children())) {
foreach ($plugins->children() as $plugin) {
$pname = $plugin->attributes('plugin');
$pgroup = $plugin->attributes('group');
$path = $src.'/plugins/'.$pgroup.'/'.$pname;
$installer = new JInstaller;
$result = $installer->install($path);
$status->plugins[] = array(
'name' => $pname,
'group' => $pgroup,
'result' => $result
);
$query = "UPDATE #__plugins SET published=1 WHERE element=".$db->Quote($pname)." AND folder=".$db->Quote($pgroup);
$db->setQuery($query);
$db->query();
}
}
}
?>
<?php if (version_compare(JVERSION, '1.6.0', 'lt')): $rows = 0; ?>
<h2><?php echo JText::_('COM_JW_DISQUS_INSTALLATION_STATUS'); ?></h2>
<table class="adminlist">
<thead>
<tr>
<th class="title" colspan="2"><?php echo JText::_('COM_JW_DISQUS_EXTENSION'); ?></th>
<th width="30%"><?php echo JText::_('COM_JW_DISQUS_STATUS'); ?></th>
</tr>
</thead>
<tbody>
<tr class="row0">
<td class="key" colspan="2"><?php echo JText::_('COM_JW_DISQUS_COMPONENT'); ?></td>
<td><strong><?php echo JText::_('COM_JW_DISQUS_INSTALLED'); ?></strong></td>
</tr>
<?php if (count($status->plugins)): ?>
<tr>
<th><?php echo JText::_('COM_JW_DISQUS_PLUGIN'); ?></th>
<th><?php echo JText::_('COM_JW_DISQUS_GROUP'); ?></th>
<th></th>
</tr>
<?php foreach ($status->plugins as $plugin): ?>
<tr class="row<?php echo(++ $rows % 2); ?>">
<td class="key"><?php echo ucfirst($plugin['name']); ?></td>
<td class="key"><?php echo ucfirst($plugin['group']); ?></td>
<td><strong><?php echo ($plugin['result']) ? JText::_('COM_JW_DISQUS_INSTALLED') : JText::_('COM_JW_DISQUS_NOT_INSTALLED'); ?></strong></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
</tr>
</tfoot>
</table>
<?php endif; ?>