These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @package Joomla.Administrator |
||
4 | * @subpackage com_localise |
||
5 | * |
||
6 | * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. |
||
7 | * @license GNU General Public License version 2 or later; see LICENSE.txt |
||
8 | */ |
||
9 | |||
10 | defined('_JEXEC') or die; |
||
11 | |||
12 | $app = JFactory::getApplication('administrator'); |
||
13 | $params = JComponentHelper::getParams('com_localise'); |
||
14 | $reference = $params->get('reference', 'en-GB'); |
||
15 | $packages = LocaliseHelper::getPackages(); |
||
16 | $user = JFactory::getUser(); |
||
17 | $userId = $user->get('id'); |
||
18 | $lang = JFactory::getLanguage(); |
||
19 | ?> |
||
20 | <?php foreach ($this->items as $i => $item) : ?> |
||
21 | <?php $canEdit = $user->authorise('localise.edit', 'com_localise' . (isset($item->id) ? ('.' . $item->id) : '')); ?> |
||
22 | <?php $istranslation = $item->istranslation; ?> |
||
23 | <?php if (!empty($item->developdata)) : |
||
24 | $extras_amount = $item->developdata; |
||
25 | $text_changes_amount = $item->developdata; |
||
26 | $extras_amount = $extras_amount['extra_keys']['amount']; |
||
27 | $text_changes_amount = $text_changes_amount['text_changes']['amount']; |
||
28 | else : |
||
29 | $extras_amount = 0; |
||
30 | $text_changes_amount = 0; |
||
31 | endif; ?> |
||
32 | <tr class="<?php echo $item->state; ?> row<?php echo $i % 2; ?>"> |
||
33 | <td width="20" class="center hidden-phone"><?php echo $i + 1; ?></td> |
||
34 | <td width="120" class="center hidden-phone"> |
||
35 | <?php |
||
36 | echo JHtml::_( |
||
37 | 'jgrid.action', |
||
38 | $i, |
||
39 | '', |
||
40 | array( |
||
41 | 'tip' => true, |
||
42 | 'inactive_title' => JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_STORAGE_' . $item->storage), |
||
43 | 'inactive_class' => '16-' . $item->storage, |
||
44 | 'enabled' => false, |
||
45 | 'translate' => false |
||
46 | ) |
||
47 | ); ?> |
||
48 | <?php if ($item->origin == '_thirdparty') : ?> |
||
49 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip' => true, 'inactive_title' => JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_ORIGIN_THIRDPARTY'), 'inactive_class' => '16-thirdparty', 'enabled' => false, 'translate' => false)); ?> |
||
50 | <?php elseif ($item->origin == '_override') : ?> |
||
51 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip' => true, 'inactive_title' => JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_ORIGIN_OVERRIDE'), 'inactive_class' => '16-override', 'enabled' => false, 'translate' => false)); ?> |
||
52 | <?php else : ?> |
||
53 | <?php if ($item->origin == 'core') : ?> |
||
54 | <?php $icon = 'core'; ?> |
||
55 | <?php else : ?> |
||
56 | <?php $icon = 'other'; ?> |
||
57 | <?php endif; ?> |
||
58 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip' => true, 'inactive_title' => JText::_($packages[$item->origin]->title) . '::' . JText::_($packages[$item->origin]->description), 'inactive_class' => '16-' . $icon, 'enabled' => false, 'translate' => false)); ?> |
||
59 | <?php endif; ?> |
||
60 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_STATE_'.$item->state, $item->translated, $item->unchanged, $item->total, $item->extra), 'inactive_class'=>'16-'.$item->state, 'enabled' => false, 'translate'=>false)); ?> |
||
61 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_TYPE_'.$item->type), 'inactive_class'=>'16-'.$item->type, 'enabled' => false, 'translate'=>false)); ?> |
||
62 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_CLIENT_'.$item->client), 'inactive_class'=>'16-'.$item->client, 'enabled' => false, 'translate'=>false)); ?> |
||
63 | <?php if ($item->tag == $reference && $item->type != 'override') : ?> |
||
64 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_REFERENCE'), 'inactive_class'=>'16-reference', 'enabled' => false, 'translate'=>false)); ?> |
||
65 | <?php endif; ?> |
||
66 | </td> |
||
67 | <td dir="ltr" class="center"><?php echo $item->tag; ?></td> |
||
68 | <td dir="ltr" class="center"><?php echo $item->client ?></td> |
||
69 | <td dir="ltr"> |
||
70 | <?php if ($item->checked_out) : ?> |
||
71 | <?php $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; ?> |
||
72 | <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'translations.', $canCheckin); ?> |
||
73 | <input type="checkbox" id="cb<?php echo $i; ?>" class="hidden" name="cid[]" value="<?php echo $item->id; ?>"> |
||
74 | <?php endif; ?> |
||
75 | <?php if ($item->writable && !$item->error && $canEdit) : ?> |
||
76 | <a class="hasTooltip" href="<?php echo JRoute::_('index.php?option=com_localise&task=translation.edit&client='.$item->client.'&tag='.$item->tag.'&filename='.$item->filename.'&storage='.$item->storage.'&id='.LocaliseHelper::getFileId(LocaliseHelper::getTranslationPath($item->client,$item->tag, $item->filename, $item->storage)).($item->filename=='override' ? '&layout=raw' :'')); ?>" title="<?php echo JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_' . ($item->state=='unexisting' ? 'NEW' : 'EDIT')); ?>"> |
||
77 | <?php echo $item->name; ?>.ini |
||
78 | </a> |
||
79 | <?php elseif (!$canEdit) : ?> |
||
80 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_NOTEDITABLE', substr($item->path, strlen(JPATH_ROOT))), 'inactive_class'=>'16-error', 'enabled' => false, 'translate'=>false)); ?> |
||
81 | <?php echo $item->name; ?>.ini |
||
82 | <?php elseif (!$item->writable) : ?> |
||
83 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_NOTWRITABLE', substr($item->path, strlen(JPATH_ROOT))), 'inactive_class'=>'16-error', 'enabled' => false, 'translate'=>false)); ?> |
||
84 | <?php echo $item->name; ?>.ini |
||
85 | <?php elseif ($item->filename=='override') : ?> |
||
86 | <?php echo $item->name; ?>.ini |
||
87 | View Code Duplication | <?php else : ?> |
|
0 ignored issues
–
show
|
|||
88 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_ERROR', substr($item->path, strlen(JPATH_ROOT)) , implode(', ',$item->error)), 'inactive_class'=>'16-error', 'enabled' => false, 'translate'=>false)); ?> |
||
89 | <?php echo $item->name; ?>.ini |
||
90 | <?php endif; ?> |
||
91 | <?php if ($item->writable && $canEdit) : ?> |
||
92 | (<a class="hasTooltip" href="<?php echo JRoute::_('index.php?option=com_localise&task=translation.edit&client=' . $item->client . '&tag=' . $item->tag . '&filename=' . $item->filename . '&storage=' . $item->storage . '&id=' . LocaliseHelper::getFileId(LocaliseHelper::getTranslationPath($item->client,$item->tag, $item->filename, $item->storage)) . '&layout=raw'); ?>" title="<?php echo JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_' . ($item->state=='unexisting' ? 'NEWRAW' : 'EDITRAW')); ?>"><?php echo JText::_('COM_LOCALISE_TEXT_TRANSLATIONS_SOURCE'); ?></a>) |
||
93 | <?php else : ?> |
||
94 | <?php echo substr($item->path,strlen(JPATH_ROOT)); ?> |
||
95 | <?php endif; ?> |
||
96 | <div class="small"> |
||
97 | <?php echo substr($item->path, strlen(JPATH_ROOT)); ?> |
||
98 | </div> |
||
99 | </td> |
||
100 | <td width="100" class="center" dir="ltr"> |
||
101 | <?php if ($item->bom != 'UTF-8') : ?> |
||
102 | <a class="jgrid hasTooltip" href="http://en.wikipedia.org/wiki/UTF-8" title="<?php echo addslashes(htmlspecialchars(JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_UTF8'), ENT_COMPAT, 'UTF-8')); ?>"> |
||
103 | <span class="state icon-16-error"></span> |
||
104 | <span class="text"></span> |
||
105 | </a> |
||
106 | View Code Duplication | <?php elseif ($item->state == 'error') : ?> |
|
107 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_ERROR',substr($item->path,strlen(JPATH_ROOT)) , implode(', ',$item->error)), 'inactive_class'=>'16-error', 'enabled' => false, 'translate'=>false)); ?> |
||
108 | <?php elseif ($item->type == 'override') : ?> |
||
109 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_TYPE_OVERRIDE'), 'inactive_class'=>'16-override', 'enabled' => false, 'translate'=>false)); ?> |
||
110 | <?php elseif ($item->state == 'notinreference') : ?> |
||
111 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_STATE_NOTINREFERENCE'), 'inactive_class'=>'16-notinreference', 'enabled' => false, 'translate'=>false)); ?> |
||
112 | View Code Duplication | <?php elseif ($item->state == 'unexisting') : ?> |
|
113 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_STATE_UNEXISTING', $item->translated, $item->unchanged, $item->total, $item->extra), 'inactive_class'=>'16-unexisting', 'enabled' => false, 'translate'=>false)); ?> |
||
114 | <?php elseif ($item->tag == $reference) : ?> |
||
115 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_REFERENCE'), 'inactive_class'=>'16-reference', 'enabled' => false, 'translate'=>false)); ?> |
||
116 | <?php elseif ($item->complete) : ?> |
||
117 | <?php if ($extras_amount > 0 || $text_changes_amount > 0) : ?> |
||
118 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_COMPLETE_WITH_DEVELOP', $item->translated, $item->unchanged, $extras_amount, $text_changes_amount, $item->total, $item->extra), 'inactive_class'=>'16-complete', 'enabled' => false, 'translate'=>false)); ?> |
||
119 | View Code Duplication | <?php else : ?> |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
120 | <?php echo JHtml::_('jgrid.action', $i, '', array('tip'=>true, 'inactive_title'=>JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_COMPLETE', $item->translated, $item->unchanged, $item->total, $item->extra), 'inactive_class'=>'16-complete', 'enabled' => false, 'translate'=>false)); ?> |
||
121 | <?php endif; ?> |
||
122 | <?php else : ?> |
||
123 | <?php if ($extras_amount > 0 || $text_changes_amount > 0) : ?> |
||
124 | <span class="hasTooltip" title="<?php echo $item->translated + $item->unchanged == 0 ? JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_NOTSTARTED') : JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_INPROGRESS_WITH_DEVELOP', $item->translated, $item->unchanged, $extras_amount, $text_changes_amount, $item->total, $item->extra); ?>"> |
||
125 | <?php else : ?> |
||
126 | <span class="hasTooltip" title="<?php echo $item->translated + $item->unchanged == 0 ? JText::_('COM_LOCALISE_TOOLTIP_TRANSLATIONS_NOTSTARTED') : JText::sprintf('COM_LOCALISE_TOOLTIP_TRANSLATIONS_INPROGRESS', $item->translated, $item->unchanged, $item->total, $item->extra); ?>"> |
||
127 | <?php endif; ?> |
||
128 | <?php $unrevised = $item->total ? intval(100 * $item->unrevised / $item->total) : 0; ?> |
||
129 | View Code Duplication | <?php if ($item->unrevised > 0 && $unrevised == 0) : ?> |
|
130 | <?php $unrevised = number_format(100 * $item->unrevised / $item->total, 2); ?> |
||
131 | <?php endif; ?> |
||
132 | <?php $untranslated = $item->total ? intval(100 * $item->untranslated / $item->total) : 0; ?> |
||
133 | View Code Duplication | <?php if ($item->untranslated > 0 && $untranslated == 0) : ?> |
|
134 | <?php $untranslated = number_format(100 * $item->untranslated / $item->total, 2); ?> |
||
135 | <?php endif; ?> |
||
136 | <?php $translated = $item->total ? intval(100 * ($item->translated + $item->translatednews) / $item->total) : 0; ?> |
||
137 | <?php if ($item->translated > 0 && $translated == 0) : ?> |
||
138 | <?php $translated = number_format(100 * ($item->translated + $item->translatednews) / $item->total, 2); ?> |
||
139 | <?php endif; ?> |
||
140 | <?php $unchangeds = $item->unchanged + $item->unchangednews; $unchanged = $item->total ? intval(100 * ($unchangeds)/ $item->total) : 0; ?> |
||
141 | <?php if ($unchangeds > 0 && $unchanged == 0) : ?> |
||
142 | <?php $unchanged = number_format(100 * $unchangeds / $item->total, 2); ?> |
||
143 | <?php endif; ?> |
||
144 | <?php if ($unchangeds) : ?> |
||
145 | ( <?php echo $translated; ?> % + <?php echo $unchanged; ?> %) |
||
146 | <?php else : ?> |
||
147 | <?php echo $translated; ?> % |
||
148 | <?php endif; ?> |
||
149 | <div style="text-align:left;border:solid silver 1px;width:100px;height:4px;"> |
||
150 | <div class="pull-left" style="height:100%; width:<?php echo $translated; ?>% ;background:green;"> |
||
151 | </div> |
||
152 | <div class="pull-left" style="height:100%; width:<?php echo $unchanged; ?>% ;background:orange;"> |
||
153 | </div> |
||
154 | <div class="pull-left" style="height:100%; width:<?php echo $unrevised; ?>% ;background:yellow;"> |
||
155 | </div> |
||
156 | <div class="pull-left" style="height:100%; width:<?php echo $untranslated; ?>% ;background:red;"> |
||
157 | </div> |
||
158 | </div> |
||
159 | <div class="clr"></div> |
||
160 | </span> |
||
161 | <?php endif; ?> |
||
162 | <?php if ($extras_amount > 0 || $text_changes_amount > 0) : ?> |
||
163 | <?php $revised = $text_changes_amount - $item->unrevised; $translatednews = $item->translatednews + $item->unchangednews; ?> |
||
164 | <?php if ($extras_amount > 0 && $text_changes_amount > 0) : ?> |
||
165 | <?php if ($istranslation == 1) : ?> |
||
166 | <br /><span class="icon-16-notice-note hasTooltip" title="<?php echo JText::sprintf('COM_LOCALISE_TOOLTIP_GITHUB_CASE_1', $translatednews, $extras_amount, $revised, $text_changes_amount); ?>"></span> |
||
167 | <?php else : ?> |
||
168 | <br /><span class="icon-16-notice-note hasTooltip" title="<?php echo JText::sprintf('COM_LOCALISE_TOOLTIP_GITHUB_CASE_1_EN_GB', $extras_amount, $revised, $text_changes_amount); ?>"></span> |
||
169 | <?php endif; ?> |
||
170 | <?php elseif ($extras_amount == 0 && $text_changes_amount > 0) : ?> |
||
171 | <?php if ($istranslation == 1) : ?> |
||
172 | <br /><span class="icon-16-notice-note hasTooltip" title="<?php echo JText::sprintf('COM_LOCALISE_TOOLTIP_GITHUB_CASE_2', $revised, $text_changes_amount); ?>"></span> |
||
173 | <?php else : ?> |
||
174 | <br /><span class="icon-16-notice-note hasTooltip" title="<?php echo JText::sprintf('COM_LOCALISE_TOOLTIP_GITHUB_CASE_2_EN_GB', $revised, $text_changes_amount); ?>"></span> |
||
175 | <?php endif; ?> |
||
176 | <?php elseif ($extras_amount > 0 && $text_changes_amount == 0) : ?> |
||
177 | <?php if ($istranslation == 1) : ?> |
||
178 | <br /><span class="icon-16-notice-note hasTooltip" title="<?php echo JText::sprintf('COM_LOCALISE_TOOLTIP_GITHUB_CASE_3', $translatednews, $extras_amount); ?>"></span> |
||
179 | <?php else : ?> |
||
180 | <br /><span class="icon-16-notice-note hasTooltip" title="<?php echo JText::sprintf('COM_LOCALISE_TOOLTIP_GITHUB_CASE_3_EN_GB', $extras_amount); ?>"></span> |
||
181 | <?php endif; ?> |
||
182 | <?php endif; ?> |
||
183 | <?php endif; ?> |
||
184 | </td> |
||
185 | <td dir="ltr" class="center"> |
||
186 | <?php if ($item->state != 'error') : ?> |
||
187 | <?php if ($item->state == 'notinreference') : ?> |
||
188 | <?php echo $item->extra; ?> |
||
189 | <?php elseif ($item->type == 'override') : ?> |
||
190 | <?php |
||
191 | elseif ($item->tag == $reference) : ?> |
||
192 | <?php echo $item->translated; ?> |
||
193 | <?php |
||
194 | else : ?> |
||
195 | <?php $unchangeds = $item->unchanged + $item->unchangednews; echo ($unchangeds ? ("(" . ($item->translated + $item->translatednews) . "+" . $unchangeds . ")") : ($item->translated + $item->translatednews)) . "/" . $item->total . ($item->extra ? "+" . $item->extra : ''); ?> |
||
196 | <?php endif; ?> |
||
197 | <?php endif; ?> |
||
198 | </td> |
||
199 | <td class="hidden-phone"> |
||
200 | <?php if ($item->state != 'unexisting') : ?> |
||
201 | <?php $description = ($item->maincopyright ? ($item->maincopyright . '<br/>') : '') . ($item->additionalcopyright ? (str_replace("\n", '<br/>', $item->additionalcopyright) . '<br/>') : '') . ($item->description ? ($item->description . '<br/>') : '') . ($item->version ? ($item->version . '<br/>') : '') . ($item->creationdate ? $item->creationdate : ''); ?> |
||
202 | <?php if ($description || $item->author) : ?> |
||
203 | <?php $author = $item->author ? $item->author : JText::_('COM_LOCALISE_TEXT_TRANSLATIONS_AUTHOR'); ?> |
||
204 | <span class="hasTooltip" title="<?php echo htmlspecialchars($description, ENT_COMPAT, 'UTF-8'); ?>"> |
||
205 | <?php echo $author; ?> |
||
206 | </span> |
||
207 | <?php endif; ?> |
||
208 | <?php endif; ?> |
||
209 | </td> |
||
210 | </tr> |
||
211 | <?php endforeach; ?> |
||
212 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.