Fix the linked [new] button to use the correct init_default params. Fix the Components list view to better display long website urls. Fix language text area css. #1264. Refactor the JS selText method. Add fix for empty currentFullPath in the Structuresingle class. Fix the buildSelectPart method to not access an empty select value in the Queries class. Fix that ensure that we always load and int into loadUserById. Fix the subform permission behaviour to use removeField. Add version 6 to the version 5 update server, for easier upgrade path. Fixed linked admin views with New and New & Close buttons to correctly initialize fields using global unique IDs and default conventions. Resolved missing language strings when linked admin views are also configured as site edit views. Corrected misconfiguration of the isModal property for site-linked views to default to false since modals are not yet supported on the site area. Enhanced security in edit views by moving access validation into the model, ensuring protection even when Joomla bypasses the controller layer. Added user access verification logic in the model to prevent unauthorized direct item loading. Refactored the view class to introduce a class constructor that initializes key dependencies more reliably. Began aligning the view class structure with Joomla 6's updated MVC architecture for future compatibility. Improved initialization handling in the view to reduce dependency errors during rendering. Fixed a bug caused by missing option settings in the model configuration. Updated and refined the site view class for greater consistency with backend view logic. Continued progressive improvements across view classes to ensure compatibility with Joomla's evolving MVC patterns. Fix permission issue in the list view. #1266. Refactor the list view buttons. Refactor the getActions helper method. Rename Custom Buttons tab to Toolbar for clearer grouping of toolbar functions. #1268. Add options for overriding default toolbars in all Admin, Site, and Custom Admin Views. #1268. Refactor toolbar into version specific classes to resolve getToolbar errors. #1267. Add method to unify getDatabase handling across Joomla versions and prevent undefined method calls. #1270. Fix php8.3 deprecation warnings in compiler templates. #1265. Refactor and enhance the JCB Email Helper class for a more robust and maintainable design. Fix an issue where the Email Helper send() function was executed twice. Fix a issue where layouts added to the PHP Ajax Model were not loaded during compilation. Add new functionality to the toolbar override system, enabling the inclusion of custom buttons via placeholders. Fix the Compiler success message to display both build seconds and project weeks. Add Development Valuation Model to calculate JCB component pricing. Add functionality to push JCB packages to Self hosted Git system that uses a self signed SSL. Add functionality that will include Validation Rules linked to fields in JCB packages. #1273. Refactor and Improve Router Helper Class to new standard Site Router practice. Refactor and Improve JCB Search engine for better searching of JCB areas. Fix bug in the search editor in JCB Search Engine. Fix issue where Custom Gets linked to a Site view did not ship correctly with JCB packages. #1272. Fix issue where the Icon linked to a Custom Admin Menu did not ship with JCB packages. #1271. Fix and Improve Normalize Class to better handle different files Linked to JCB packages. #1274. Remove batch feature from JCB compiler Templates due to lack of use and outdated code. Refactor Utilities/Response classes for Joomla 6+ compatibility and improved version-agnostic behavior. Refactor the File Upload Manager to achieve improved maintainability, greater customization flexibility, and easier extensibility. Refactor the Item Importer to improve data management, structural clarity, and long-term maintainability of the import process. Add a Pull button to all main JCB entities, allowing a complete reset of a selected entity together with all entities linked to it, from a selected remote repository. Add functionality to the compiler to automatically pull missing entities from a remote repository when they are referenced by a component but not present locally in JCB. Refactor the Packaging Engine into separate set and get classes to improve separation of concerns, readability, and overall maintainability. Refactor and restructure the demo console item import plugin to improve usability, maintainability, and reusability across other areas of JCB. Refactor the Compiler to remove deprecated code paths and legacy classes that are no longer maintained. Add new Compiler Classes to modernise ancient tech previously embedded in the compiler and replace it with a clean, modern architecture. Add a dedicated CLI plugin to the JCB core, enabling direct interaction with JCB through the Joomla CLI console. Add structured CLI commands and options to Init, Reset, Push, and Pull JCB entities via the Joomla CLI. Add full support for compiling Components directly via the CLI, enabling automated and headless build workflows. Add functionality to place Super Power classes into the component src folder for both Admin and Site areas, using the correct namespaced structure. Add functionality to the CLI compiler to directly install compiled components and apply compiler options used during compilation. Add functionality to the compiler to automatically pull a missing component from a remote repository when a compilation is triggered and the component is not locally available. Add functionality to add and replace classes in module and plugin src folders that are linked to a component, when using correct namespace resolution. Add a Documentation tab to the Joomla Component Builder dashboard. Fix an issue with the JCB version notice on Joomla 5. Fix an issue where components without a component image failed to compile successfully. #1282. Add functionality for importing translated language strings directly into the Language Translations area of JCB. Fix issue where the Language Translations export button was not displayed due to recent toolbar changes. Fix a bug that caused language filters to malfunction because of a broken field configuration. #1278. Fix issue where components without a layout added to the Component failed to compile correctly. #1132.
749 lines
22 KiB
PHP
749 lines
22 KiB
PHP
<?php
|
|
/**
|
|
* @package Joomla.Component.Builder
|
|
*
|
|
* @created 4th September 2022
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
*/
|
|
|
|
// No direct access to this JCB template file (EVER)
|
|
defined('_JCB_TEMPLATE') or die;
|
|
?>
|
|
###BOM###
|
|
namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Site\Helper;
|
|
|
|
###SITE_POWER_AUTOLOADER###
|
|
|
|
###SITE_HELPER_CLASS_HEADER###
|
|
|
|
// No direct access to this file
|
|
\defined('_JEXEC') or die;
|
|
|
|
/**
|
|
* ###Component### component helper
|
|
*
|
|
* @since 3.0
|
|
*/
|
|
abstract class ###Component###Helper
|
|
{
|
|
/**
|
|
* Composer Switch
|
|
*
|
|
* @var array
|
|
*/
|
|
protected static $composer = [];
|
|
|
|
/**
|
|
* The Main Active Language
|
|
*
|
|
* @var string
|
|
*/
|
|
public static $langTag;###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT###
|
|
|
|
/**
|
|
* Load the Composer Vendors
|
|
*/
|
|
public static function composerAutoload($target)
|
|
{
|
|
// insure we load the composer vendor only once
|
|
if (!isset(self::$composer[$target]))
|
|
{
|
|
// get the function name
|
|
$functionName = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe('compose' . $target);
|
|
// check if method exist
|
|
if (method_exists(__CLASS__, $functionName))
|
|
{
|
|
return self::{$functionName}();
|
|
}
|
|
return false;
|
|
}
|
|
return self::$composer[$target];
|
|
}
|
|
|
|
/**
|
|
* Convert a json object to a string
|
|
*
|
|
* @input string $value The json string to convert
|
|
*
|
|
* @returns a string
|
|
* @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(...);
|
|
*/
|
|
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
|
|
{
|
|
return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::string(
|
|
$value,
|
|
$sperator,
|
|
$table,
|
|
$id,
|
|
$name
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Load the Component xml manifest.
|
|
*/
|
|
public static function manifest()
|
|
{
|
|
$manifestUrl = JPATH_ADMINISTRATOR."/components/com_###component###/###component###.xml";
|
|
return simplexml_load_file($manifestUrl);
|
|
}
|
|
|
|
/**
|
|
* Joomla version object
|
|
*/
|
|
protected static $JVersion;
|
|
|
|
/**
|
|
* set/get Joomla version
|
|
*/
|
|
public static function jVersion()
|
|
{
|
|
// check if set
|
|
if (!Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check(self::$JVersion))
|
|
{
|
|
self::$JVersion = new Version();
|
|
}
|
|
return self::$JVersion;
|
|
}
|
|
|
|
/**
|
|
* Load the Contributors details.
|
|
*/
|
|
public static function getContributors()
|
|
{
|
|
// get params
|
|
$params = Joomla___aeb8e463_291f_4445_9ac4_34b637c12dbd___Power::getParams('com_###component###');
|
|
// start contributors array
|
|
$contributors = [];
|
|
// get all Contributors (max 20)
|
|
$searchArray = range('0','20');
|
|
foreach($searchArray as $nr)
|
|
{
|
|
if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 2 || $params->get("showContributor".$nr) == 3))
|
|
{
|
|
// set link based of selected option
|
|
if($params->get("useContributor".$nr) == 1)
|
|
{
|
|
$link_front = '<a href="mailto:'.$params->get("emailContributor".$nr).'" target="_blank">';
|
|
$link_back = '</a>';
|
|
}
|
|
elseif($params->get("useContributor".$nr) == 2)
|
|
{
|
|
$link_front = '<a href="'.$params->get("linkContributor".$nr).'" target="_blank">';
|
|
$link_back = '</a>';
|
|
}
|
|
else
|
|
{
|
|
$link_front = '';
|
|
$link_back = '';
|
|
}
|
|
$contributors[$nr]['title'] = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("titleContributor".$nr));
|
|
$contributors[$nr]['name'] = $link_front.Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($params->get("nameContributor".$nr)).$link_back;
|
|
}
|
|
}
|
|
return $contributors;
|
|
}###HELP_SITE###
|
|
|
|
/**
|
|
* Returns any Model object.
|
|
*
|
|
* @param string $type The model type to instantiate
|
|
* @param string $prefix Prefix for the model class name. Optional.
|
|
* @param string $component Component name the model belongs to. Optional.
|
|
* @param array $config Configuration array for model. Optional.
|
|
*
|
|
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel
|
|
* @throws \Exception
|
|
* @since 4.4
|
|
*/
|
|
public static function getModel(string $type, string $prefix = 'Site',
|
|
string $component = '###component###', array $config = [])
|
|
{
|
|
// make sure the name is correct
|
|
$type = Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe($type, 'F');
|
|
$component = strtolower($component);
|
|
|
|
if ($prefix !== 'Site' && $prefix !== 'Administrator')
|
|
{
|
|
$prefix = self::getPrefixFromModelPath($prefix);
|
|
}
|
|
|
|
// Get the model through the MVCFactory
|
|
return Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->bootComponent('com_' . $component)->getMVCFactory()->createModel($type, $prefix, $config);
|
|
}
|
|
|
|
/**
|
|
* Get the prefix from the model path
|
|
*
|
|
* @param string $path The model path
|
|
*
|
|
* @return string The prefix value
|
|
* @since 4.4
|
|
*/
|
|
protected static function getPrefixFromModelPath(string $path): string
|
|
{
|
|
// Check if $path starts with JPATH_ADMINISTRATOR path
|
|
if (str_starts_with($path, JPATH_ADMINISTRATOR . '/components/'))
|
|
{
|
|
return 'Administrator';
|
|
}
|
|
// Check if $path starts with JPATH_SITE path
|
|
elseif (str_starts_with($path, JPATH_SITE . '/components/'))
|
|
{
|
|
return 'Site';
|
|
}
|
|
|
|
return 'Site';
|
|
}
|
|
|
|
/**
|
|
* Add to asset Table
|
|
*/
|
|
public static function setAsset($id, $table, $inherit = true)
|
|
{
|
|
$parent = Table::getInstance('Asset');
|
|
$parent->loadByName('com_###component###');
|
|
|
|
$parentId = $parent->id;
|
|
$name = 'com_###component###.'.$table.'.'.$id;
|
|
$title = '';
|
|
|
|
$asset = Table::getInstance('Asset');
|
|
$asset->loadByName($name);
|
|
|
|
// Check for an error.
|
|
$error = $asset->getError();
|
|
|
|
if ($error)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
// Specify how a new or moved node asset is inserted into the tree.
|
|
if ($asset->parent_id != $parentId)
|
|
{
|
|
$asset->setLocation($parentId, 'last-child');
|
|
}
|
|
|
|
// Prepare the asset to be stored.
|
|
$asset->parent_id = $parentId;
|
|
$asset->name = $name;
|
|
$asset->title = $title;
|
|
// get the default asset rules
|
|
$rules = self::getDefaultAssetRules('com_###component###', $table, $inherit);
|
|
if ($rules instanceof AccessRules)
|
|
{
|
|
$asset->rules = (string) $rules;
|
|
}
|
|
|
|
if (!$asset->check() || !$asset->store())
|
|
{
|
|
Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getApplication()->enqueueMessage($asset->getError(), 'warning');
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
// Create an asset_id or heal one that is corrupted.
|
|
$object = new \StdClass();
|
|
|
|
// Must be a valid primary key value.
|
|
$object->id = $id;
|
|
$object->asset_id = (int) $asset->id;
|
|
|
|
// Update their asset_id to link to the asset table.
|
|
return Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getDbo()->updateObject('#__###component###_'.$table, $object, 'id');
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Gets the default asset Rules for a component/view.
|
|
*/
|
|
protected static function getDefaultAssetRules($component, $view, $inherit = true)
|
|
{
|
|
// if new or inherited
|
|
$assetId = 0;
|
|
// Only get the actual item rules if not inheriting
|
|
if (!$inherit)
|
|
{
|
|
// Need to find the asset id by the name of the component.
|
|
$db = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getContainer()->get(DatabaseInterface::class);
|
|
$query = $db->getQuery(true)
|
|
->select($db->quoteName('id'))
|
|
->from($db->quoteName('#__assets'))
|
|
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
|
$db->setQuery($query);
|
|
$db->execute();
|
|
// check that there is a value
|
|
if ($db->getNumRows())
|
|
{
|
|
// asset already set so use saved rules
|
|
$assetId = (int) $db->loadResult();
|
|
}
|
|
}
|
|
// get asset rules
|
|
$result = Access::getAssetRules($assetId);
|
|
if ($result instanceof AccessRules)
|
|
{
|
|
$_result = (string) $result;
|
|
$_result = json_decode($_result);
|
|
foreach ($_result as $name => &$rule)
|
|
{
|
|
$v = explode('.', $name);
|
|
if ($view !== $v[0])
|
|
{
|
|
// remove since it is not part of this view
|
|
unset($_result->$name);
|
|
}
|
|
elseif ($inherit)
|
|
{
|
|
// clear the value since we inherit
|
|
$rule = [];
|
|
}
|
|
}
|
|
// check if there are any view values remaining
|
|
if (count((array) $_result))
|
|
{
|
|
$_result = json_encode($_result);
|
|
$_result = array($_result);
|
|
// Instantiate and return the AccessRules object for the asset rules.
|
|
$rules = new AccessRules($_result);
|
|
// return filtered rules
|
|
return $rules;
|
|
}
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* xmlAppend
|
|
*
|
|
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
|
* @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement
|
|
*
|
|
* @return void
|
|
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node);
|
|
*/
|
|
public static function xmlAppend(&$xml, $node)
|
|
{
|
|
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::append($xml, $node);
|
|
}
|
|
|
|
/**
|
|
* xmlComment
|
|
*
|
|
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
|
* @param string $comment The comment to inject
|
|
*
|
|
* @return void
|
|
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment);
|
|
*/
|
|
public static function xmlComment(&$xml, $comment)
|
|
{
|
|
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::comment($xml, $comment);
|
|
}
|
|
|
|
/**
|
|
* xmlAddAttributes
|
|
*
|
|
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
|
* @param array $attributes The attributes to apply to the XML element
|
|
*
|
|
* @return null
|
|
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes);
|
|
*/
|
|
public static function xmlAddAttributes(&$xml, $attributes = [])
|
|
{
|
|
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::attributes($xml, $attributes);
|
|
}
|
|
|
|
/**
|
|
* xmlAddOptions
|
|
*
|
|
* @param SimpleXMLElement $xml The XML element reference in which to inject a comment
|
|
* @param array $options The options to apply to the XML element
|
|
*
|
|
* @return void
|
|
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options);
|
|
*/
|
|
public static function xmlAddOptions(&$xml, $options = [])
|
|
{
|
|
Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::options($xml, $options);
|
|
}
|
|
|
|
/**
|
|
* get the field object
|
|
*
|
|
* @param array $attributes The array of attributes
|
|
* @param string $default The default of the field
|
|
* @param array $options The options to apply to the XML element
|
|
*
|
|
* @return object
|
|
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options);
|
|
*/
|
|
public static function getFieldObject(&$attributes, $default = '', $options = null)
|
|
{
|
|
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($attributes, $default, $options);
|
|
}
|
|
|
|
/**
|
|
* get the field xml
|
|
*
|
|
* @param array $attributes The array of attributes
|
|
* @param array $options The options to apply to the XML element
|
|
*
|
|
* @return object
|
|
* @deprecated 3.3 Use Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options);
|
|
*/
|
|
public static function getFieldXML(&$attributes, $options = null)
|
|
{
|
|
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::xml($attributes, $options);
|
|
}
|
|
|
|
/**
|
|
* Render Bool Button
|
|
*
|
|
* @param array $args All the args for the button
|
|
* 0) name
|
|
* 1) additional (options class) // not used at this time
|
|
* 2) default
|
|
* 3) yes (name)
|
|
* 4) no (name)
|
|
*
|
|
* @return string The input html of the button
|
|
*
|
|
*/
|
|
public static function renderBoolButton()
|
|
{
|
|
$args = func_get_args();
|
|
// check if there is additional button class
|
|
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
|
// button attributes
|
|
$buttonAttributes = array(
|
|
'type' => 'radio',
|
|
'name' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]) : 'bool_button',
|
|
'label' => isset($args[0]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[0]), 'Ww') : 'Bool Button', // not seen anyway
|
|
'class' => 'btn-group',
|
|
'filter' => 'INT',
|
|
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
|
// set the button options
|
|
$buttonOptions = array(
|
|
'1' => isset($args[3]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[3]) : 'JYES',
|
|
'0' => isset($args[4]) ? Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($args[4]) : 'JNO');
|
|
// return the input
|
|
return Super___1198aecf_84c6_45d2_aea8_d531aa4afdfa___Power::field($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
|
}###HELPER_UIKIT######HELPER_CREATEUSER###
|
|
|
|
/**
|
|
* Get a variable
|
|
*
|
|
* @param string $table The table from which to get the variable
|
|
* @param string $where The value where
|
|
* @param string $whereString The target/field string where/name
|
|
* @param string $what The return field
|
|
* @param string $operator The operator between $whereString/field and $where/value
|
|
* @param string $main The component in which the table is found
|
|
*
|
|
* @return mix string/int/float
|
|
* @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(...);
|
|
*/
|
|
public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = '###component###')
|
|
{
|
|
return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::var(
|
|
$table,
|
|
$where,
|
|
$whereString,
|
|
$what,
|
|
$operator,
|
|
$main
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get array of variables
|
|
*
|
|
* @param string $table The table from which to get the variables
|
|
* @param string $where The value where
|
|
* @param string $whereString The target/field string where/name
|
|
* @param string $what The return field
|
|
* @param string $operator The operator between $whereString/field and $where/value
|
|
* @param string $main The component in which the table is found
|
|
* @param bool $unique The switch to return a unique array
|
|
*
|
|
* @return array
|
|
* @deprecated 3.3 Use Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(...);
|
|
*/
|
|
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = '###component###', $unique = true)
|
|
{
|
|
return Super___db87c339_5bb6_4291_a7ef_2c48ea1b06bc___Power::vars(
|
|
$table,
|
|
$where,
|
|
$whereString,
|
|
$what,
|
|
$operator,
|
|
$main,
|
|
$unique
|
|
);
|
|
}
|
|
|
|
public static function isPublished($id,$type)
|
|
{
|
|
if ($type == 'raw')
|
|
{
|
|
$type = 'item';
|
|
}
|
|
$db = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getContainer()->get(DatabaseInterface::class);
|
|
$query = $db->getQuery(true);
|
|
$query->select(array('a.published'));
|
|
$query->from('#__###component###_'.$type.' AS a');
|
|
$query->where('a.id = '. (int) $id);
|
|
$query->where('a.published = 1');
|
|
$db->setQuery($query);
|
|
$db->execute();
|
|
$found = $db->getNumRows();
|
|
if($found)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static function getGroupName($id)
|
|
{
|
|
$db = Joomla___39403062_84fb_46e0_bac4_0023f766e827___Power::getContainer()->get(DatabaseInterface::class);
|
|
$query = $db->getQuery(true);
|
|
$query->select(array('a.title'));
|
|
$query->from('#__usergroups AS a');
|
|
$query->where('a.id = '. (int) $id);
|
|
$db->setQuery($query);
|
|
$db->execute();
|
|
$found = $db->getNumRows();
|
|
if($found)
|
|
{
|
|
return $db->loadResult();
|
|
}
|
|
return $id;
|
|
}
|
|
|
|
/**
|
|
* Get the permitted actions of a user.
|
|
*
|
|
* @param string $view The related view name
|
|
* @param ?object $record The item to act upon
|
|
* @param ?string $views The related list view name
|
|
* @param mixed $target Only get this permission (like edit, create, delete)
|
|
* @param string $component The target component
|
|
* @param object $user The user whose permissions we are loading
|
|
*
|
|
* @return object The Registry of permission/authorised actions
|
|
* @since 2.5.0
|
|
*
|
|
* @deprecated 5.1.4 Use Super___7d95ce74_53dc_4672_bd8a_3b71cdacabea___Power::get(...);
|
|
*/
|
|
public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null')
|
|
{
|
|
return Super___7d95ce74_53dc_4672_bd8a_3b71cdacabea___Power::get($view, $record, $views, $target, $component, $user);
|
|
}
|
|
|
|
/**
|
|
* Check if have an json string
|
|
*
|
|
* @input string The json string to check
|
|
*
|
|
* @returns bool true on success
|
|
* @deprecated 3.3 Use Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string);
|
|
*/
|
|
public static function checkJson($string)
|
|
{
|
|
return Super___4b225c51_d293_48e4_b3f6_5136cf5c3f18___Power::check($string);
|
|
}
|
|
|
|
/**
|
|
* Check if have an object with a length
|
|
*
|
|
* @input object The object to check
|
|
*
|
|
* @returns bool true on success
|
|
* @deprecated 3.3 Use Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object);
|
|
*/
|
|
public static function checkObject($object)
|
|
{
|
|
return Super___91004529_94a9_4590_b842_e7c6b624ecf5___Power::check($object);
|
|
}
|
|
|
|
/**
|
|
* Check if have an array with a length
|
|
*
|
|
* @input array The array to check
|
|
*
|
|
* @returns bool/int number of items in array on success
|
|
* @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString);
|
|
*/
|
|
public static function checkArray($array, $removeEmptyString = false)
|
|
{
|
|
return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($array, $removeEmptyString);
|
|
}
|
|
|
|
/**
|
|
* Check if have a string with a length
|
|
*
|
|
* @input string The string to check
|
|
*
|
|
* @returns bool true on success
|
|
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string);
|
|
*/
|
|
public static function checkString($string)
|
|
{
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($string);
|
|
}
|
|
|
|
/**
|
|
* Check if we are connected
|
|
* Thanks https://stackoverflow.com/a/4860432/1429677
|
|
*
|
|
* @returns bool true on success
|
|
*/
|
|
public static function isConnected()
|
|
{
|
|
// If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right?
|
|
$connected = @fsockopen("www.example.com", 80);
|
|
// website, port (try 80 or 443)
|
|
if ($connected)
|
|
{
|
|
//action when connected
|
|
$is_conn = true;
|
|
fclose($connected);
|
|
}
|
|
else
|
|
{
|
|
//action in connection failure
|
|
$is_conn = false;
|
|
}
|
|
return $is_conn;
|
|
}
|
|
|
|
/**
|
|
* Merge an array of array's
|
|
*
|
|
* @input array The arrays you would like to merge
|
|
*
|
|
* @returns array on success
|
|
* @deprecated 3.3 Use Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays);
|
|
*/
|
|
public static function mergeArrays($arrays)
|
|
{
|
|
return Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::merge($arrays);
|
|
}
|
|
|
|
// typo sorry!
|
|
public static function sorten($string, $length = 40, $addTip = true)
|
|
{
|
|
return self::shorten($string, $length, $addTip);
|
|
}
|
|
|
|
/**
|
|
* Shorten a string
|
|
*
|
|
* @input string The you would like to shorten
|
|
*
|
|
* @returns string on success
|
|
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten(...);
|
|
*/
|
|
public static function shorten($string, $length = 40, $addTip = true)
|
|
{
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::shorten($string, $length, $addTip);
|
|
}
|
|
|
|
/**
|
|
* Making strings safe (various ways)
|
|
*
|
|
* @input string The you would like to make safe
|
|
*
|
|
* @returns string on success
|
|
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(...);
|
|
*/
|
|
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
|
{
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::safe(
|
|
$string,
|
|
$type,
|
|
$spacer,
|
|
$replaceNumbers,
|
|
$keepOnlyCharacters
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Convert none English strings to code usable string
|
|
*
|
|
* @input an string
|
|
*
|
|
* @returns a string
|
|
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string);
|
|
*/
|
|
public static function transliterate($string)
|
|
{
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::transliterate($string);
|
|
}
|
|
|
|
/**
|
|
* make sure a string is HTML save
|
|
*
|
|
* @input an html string
|
|
*
|
|
* @returns a string
|
|
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(...);
|
|
*/
|
|
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
|
|
{
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html(
|
|
$var,
|
|
$charset,
|
|
$shorten,
|
|
$length
|
|
);
|
|
}###HELPER_SITE_LICENSE_LOCK###
|
|
|
|
/**
|
|
* Convert all int in a string to an English word string
|
|
*
|
|
* @input an string with numbers
|
|
*
|
|
* @returns a string
|
|
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string);
|
|
*/
|
|
public static function replaceNumbers($string)
|
|
{
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::numbers($string);
|
|
}
|
|
|
|
/**
|
|
* Convert an integer into an English word string
|
|
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
|
|
*
|
|
* @input an int
|
|
* @returns a string
|
|
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x);
|
|
*/
|
|
public static function numberToString($x)
|
|
{
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::number($x);
|
|
}
|
|
|
|
/**
|
|
* Random Key
|
|
*
|
|
* @returns a string
|
|
* @deprecated 3.3 Use Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size);
|
|
*/
|
|
public static function randomkey($size)
|
|
{
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::random($size);
|
|
}###GET_CRYPT_KEY###
|
|
}
|