GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( ff89c5...24245f )
by
unknown
15:11 queued 06:12
created

component/admin/views/packages/view.html.php (1 issue)

Upgrade to new PHP Analysis Engine

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     Com_Localise
4
 * @subpackage  views
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
/**
13
 * Packages View class for the Localise component
14
 *
15
 * @package     Extensions.Components
16
 * @subpackage  Localise
17
 *
18
 * @since       1.0
19
 */
20
class LocaliseViewPackages extends JViewLegacy
21
{
22
	protected $items;
23
24
	protected $pagination;
25
26
	protected $form;
27
28
	protected $state;
29
30
	protected $minCmsVersion = '3.8';
31
32
	/**
33
	 * Display the view
34
	 *
35
	 * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
36
	 *
37
	 * @return  void
38
	 */
39
	public function display($tpl = null)
40
	{
41
		// Get the data
42
		$app				= JFactory::getApplication();
43
		$this->items		= $this->get('Items');
44
		$this->pagination	= $this->get('Pagination');
45
		$this->state		= $this->get('State');
46
		$this->form			= $this->get('Form');
47
		$this->file			= $app->input->get('file');
48
49 View Code Duplication
		if (version_compare(JVERSION, $this->minCmsVersion, 'lt'))
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...
50
		{
51
			JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_LOCALISE_ERROR_INSTALL_JVERSION', $this->minCmsVersion), 'warning');
52
53
			return false;
54
		}
55
56
		LocaliseHelper::addSubmenu('packages');
57
58
		// Check for errors.
59
		if (count($errors = $this->get('Errors')))
60
		{
61
			JError::raiseError(500, implode('<br />', $errors));
62
63
			return false;
64
		}
65
66
		// Set the toolbar
67
		$this->addToolbar();
68
		$this->sidebar = JHtmlSidebar::render();
69
70
		// Prepare the document
71
		$this->prepareDocument();
72
73
		// Display the view
74
		parent::display($tpl);
75
	}
76
77
	/**
78
	 * Prepare Document
79
	 *
80
	 * @return  void
81
	 */
82
	protected function prepareDocument()
83
	{
84
		$document = JFactory::getDocument();
85
		$document->setTitle(JText::sprintf('COM_LOCALISE_TITLE', JText::_('COM_LOCALISE_TITLE_PACKAGES')));
86
	}
87
88
	/**
89
	 * Add the page title and toolbar.
90
	 *
91
	 * @return  void
92
	 *
93
	 * @since   1.6
94
	 */
95
	protected function addToolbar()
96
	{
97
		$canDo = JHelperContent::getActions('com_localise', 'component');
98
99
		JToolBarHelper::title(JText::sprintf('COM_LOCALISE_HEADER_MANAGER', JText::_('COM_LOCALISE_HEADER_PACKAGES')), 'comments-2 langmanager');
100
101
		if ($canDo->get('localise.create'))
102
		{
103
			JToolbarHelper::addNew('package.add', 'COM_LOCALISE_NEW_CORE_PACKAGE');
104
		}
105
106
		if ($canDo->get('localise.create'))
107
		{
108
			JToolbarHelper::addNew('packagefile.add', 'COM_LOCALISE_NEW_FILE_PACKAGE');
109
		}
110
111
		if ($canDo->get('localise.create') || $canDo->get('localise.edit'))
112
		{
113
			JToolbarHelper::divider();
114
		}
115
116
		if ($canDo->get('localise.create'))
117
		{
118
			JToolbarHelper::custom('packages.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true);
119
		}
120
121
		if ($canDo->get('localise.delete'))
122
		{
123
			JToolbarHelper::deleteList('COM_LOCALISE_MSG_PACKAGES_VALID_DELETE', 'packages.delete');
124
			JToolBarHelper::divider();
125
		}
126
127
		if ($canDo->get('localise.create'))
128
		{
129
			JToolbarHelper::modal('fileModal', 'icon-upload', 'COM_LOCALISE_BUTTON_IMPORT_XML');
130
			JToolBarHelper::divider();
131
			JToolbarHelper::custom('packages.export',  'out.png', 'out.png', 'COM_LOCALISE_BUTTON_EXPORT_XML', true, false);
132
			JToolBarHelper::divider();
133
		}
134
135
		if ($canDo->get('core.admin'))
136
		{
137
			JToolbarHelper::preferences('com_localise');
138
			JToolbarHelper::divider();
139
		}
140
141
		JToolBarHelper::help('screen.packages', true);
142
	}
143
144
	/**
145
	 * Returns an array of fields the table can be sorted by
146
	 *
147
	 * @return  array  Array containing the field name to sort by as the key and display text as value
148
	 *
149
	 * @since 3.0
150
	 */
151
	protected function getSortFields()
152
	{
153
		return array(
154
			'title'    => JText::_('COM_LOCALISE_HEADING_PACKAGES_TITLE'),
155
			'language' => JText::_('COM_LOCALISE_LABEL_PACKAGE_LANGUAGE'),
156
			'version'  => JText::_('COM_LOCALISE_LABEL_PACKAGE_VERSION'),
157
			'core'     => JText::_('COM_LOCALISE_HEADING_PACKAGES_TYPE'),
158
		);
159
	}
160
}
161