- md5
- 8306789ece2a85ad65a49796fcb6c691
- sha1
- d6ba167f5e9baf26572110e0652ac4eb9eeb3384
- sha256
- 622a6db3ed656b913fef1d1ee151607176052e281efb1258e67cff51d44653e6
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
<?php
/**
* @package Joomla.Administrator
* @subpackage com_fields
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
JLoader::register('JFolder', JPATH_LIBRARIES . '/joomla/filesystem/folder.php');
/**
* Fields component helper.
*
* @since 3.7.0
*/
class FieldsHelperInternal
{
/**
* Configure the Linkbar.
*
* @param string $context The context the fields are used for
* @param string $vName The view currently active
*
* @return void
*
* @since 3.7.0
*/
public static function addSubmenu ($context, $vName)
{
$parts = FieldsHelper::extract($context);
if (!$parts)
{
return;
}
$component = $parts[0];
// Avoid nonsense situation.
if ($component == 'com_fields')
{
return;
}
// Try to find the component helper.
$eName = str_replace('com_', '', $component);
$file = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php');
if (!file_exists($file))
{
return;
}
require_once $file;
$cName = ucfirst($eName) . 'Helper';
if (class_exists($cName) && is_callable(array($cName, 'addSubmenu')))
{
$lang = JFactory::getLanguage();
$lang->load($component, JPATH_ADMINISTRATOR)
|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component);
$cName::addSubmenu('fields.' . $vName);
}
}
/**
* Return a boolean if the actual logged in user can edit the given field value.
*
* @param stdClass $field The field
*
* @return boolean
*
* @since 3.7.0
*/
public static function canEditFieldValue($field)
{
$parts = FieldsHelper::extract($field->context);
return JFactory::getUser()->authorise('core.edit.value', $parts[0] . '.field.' . (int) $field->id);
}
/**
* Loads the fields plugins.
*
* @return void
*
* @since 3.7.0
*/
public static function loadPlugins()
{
foreach (JFolder::listFolderTree(JPATH_PLUGINS . '/fields', '.', 1) as $folder)
{
if (!JPluginHelper::isEnabled('fields', $folder['name']))
{
continue;
}
JFactory::getLanguage()->load('plg_fields_' . strtolower($folder['name']), JPATH_ADMINISTRATOR);
JFactory::getLanguage()->load('plg_fields_' . strtolower($folder['name']), $folder['fullname']);
JFormHelper::addFieldPath($folder['fullname'] . '/fields');
}
}
}
No other release has this exact content. See every version of this file.