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.

LocaliseViewPackage   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 0
dl 0
loc 104
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A display() 0 32 2
B addToolbar() 0 37 7
A prepareDocument() 0 5 1
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
 * Package View class for the Localise component
14
 *
15
 * @package     Extensions.Components
16
 * @subpackage  Localise
17
 *
18
 * @since       1.0
19
 */
20
class LocaliseViewPackage extends JViewLegacy
21
{
22
	protected $state;
23
24
	protected $item;
25
26
	protected $form;
27
28
	/**
29
	 * Display the view
30
	 *
31
	 * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
32
	 *
33
	 * @return  void
34
	 */
35
	public function display($tpl = null)
36
	{
37
		jimport('joomla.client.helper');
38
39
		// Get the data
40
		$app           = JFactory::getApplication();
41
		$this->state   = $this->get('State');
42
		$this->item    = $this->get('Item');
43
		$this->form    = $this->get('Form');
44
		$this->formftp = $this->get('FormFtp');
45
		$this->ftp     = JClientHelper::setCredentialsFromRequest('ftp');
46
		$this->file    = $app->input->get('file');
47
		$this->fileName = base64_decode($this->file);
48
		$this->location	= $app->input->get('location');
49
50
		// Check for errors.
51
		if (count($errors = $this->get('Errors')))
52
		{
53
			JError::raiseError(500, implode("\n", $errors));
54
55
			return false;
56
		}
57
58
		// Set the toolbar
59
		$this->addToolbar();
60
61
		// Prepare the document
62
		$this->prepareDocument();
63
64
		// Display the view
65
		parent::display($tpl);
66
	}
67
68
	/**
69
	 * Add the page title and toolbar.
70
	 *
71
	 * @return  void
72
	 *
73
	 * @since   1.6
74
	 */
75
	protected function addToolbar()
76
	{
77
		JFactory::getApplication()->input->set('hidemainmenu', true);
78
79
		$user		= JFactory::getUser();
80
		$canDo		= JHelperContent::getActions('com_localise', 'component');
81
		$isNew		= empty($this->item->id);
82
		$checkedOut	= !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
83
84
		JToolbarHelper::title(
85
			JText::sprintf(
86
				'COM_LOCALISE_HEADER_MANAGER',
87
				$isNew ? JText::_('COM_LOCALISE_HEADER_PACKAGE_NEW') : JText::_('COM_LOCALISE_HEADER_PACKAGE_EDIT')
88
			),
89
			'comments-2 langmanager'
90
		);
91
92
		// If not checked out, can save the item.
93
		if (!$checkedOut)
94
		{
95
			JToolbarHelper::apply('package.apply');
96
			JToolbarHelper::save('package.save');
97
		}
98
99
		if (!$isNew && $canDo->get('localise.create'))
100
		{
101
			JToolBarHelper::divider();
102
			JToolbarHelper::modal('fileModal', 'icon-upload', 'COM_LOCALISE_BUTTON_IMPORT_FILE');
103
			JToolBarHelper::divider();
104
		}
105
106
		JToolbarHelper::custom('package.download', 'out.png', 'out.png', 'COM_LOCALISE_TOOLBAR_PACKAGE_DOWNLOAD', false);
107
		JToolBarHelper::divider();
108
		JToolBarHelper::cancel("package.cancel", $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
109
		JToolBarHelper::divider();
110
		JToolBarHelper::help('screen.package', true);
111
	}
112
113
	/**
114
	 * Prepare Document
115
	 *
116
	 * @return  void
117
	 */
118
	protected function prepareDocument()
119
	{
120
		$document = JFactory::getDocument();
121
		$document->setTitle(JText::sprintf('COM_LOCALISE_TITLE', JText::_('COM_LOCALISE_TITLE_PACKAGE')));
122
	}
123
}
124