diff --git a/README.md b/README.md index 2fd4b4522..d76cf82d9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.15) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.16) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -143,14 +143,14 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 15th January, 2022 -+ *Version*: 2.12.15 ++ *Last Build*: 4th April, 2022 ++ *Version*: 2.12.16 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **286035** -+ *Field count*: **1572** -+ *File count*: **1829** -+ *Folder count*: **256** ++ *Line count*: **286290** ++ *Field count*: **1580** ++ *File count*: **1850** ++ *Folder count*: **260** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/README.txt b/admin/README.txt index 2fd4b4522..d76cf82d9 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.15) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.16) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -143,14 +143,14 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 15th January, 2022 -+ *Version*: 2.12.15 ++ *Last Build*: 4th April, 2022 ++ *Version*: 2.12.16 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **286035** -+ *Field count*: **1572** -+ *File count*: **1829** -+ *Folder count*: **256** ++ *Line count*: **286290** ++ *Field count*: **1580** ++ *File count*: **1850** ++ *Folder count*: **260** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/compiler/joomla_3/DASHJViewLagacy.php b/admin/compiler/joomla_3/DASHJViewLagacy.php index f8570c57e..c9a759f75 100644 --- a/admin/compiler/joomla_3/DASHJViewLagacy.php +++ b/admin/compiler/joomla_3/DASHJViewLagacy.php @@ -62,10 +62,10 @@ class ###Component###View###Component### extends JViewLegacy JToolBarHelper::title(JText::_('COM_###COMPONENT###_DASHBOARD'), 'grid-2'); // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###component###'); - if (###Component###Helper::checkString($help_url)) + $this->help_url = ###Component###Helper::getHelpUrl('###component###'); + if (###Component###Helper::checkString($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } if ($canDo->get('core.admin') || $canDo->get('core.options')) diff --git a/admin/compiler/joomla_3/Helper.php b/admin/compiler/joomla_3/Helper.php index 0cfa0cee0..12ed53087 100644 --- a/admin/compiler/joomla_3/Helper.php +++ b/admin/compiler/joomla_3/Helper.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access');###ADMIN_POWER_HELPER### ###ADMIN_HELPER_CLASS_HEADER### @@ -36,7 +36,7 @@ abstract class ###Component###Helper * * @var string */ - public static $langTag;###ADMIN_GLOBAL_EVENT_HELPER######CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT######ADMIN_POWER_EVENT_HELPER### + public static $langTag;###ADMIN_GLOBAL_EVENT_HELPER######CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT### /** * Load the Composer Vendors @@ -1339,3 +1339,4 @@ abstract class ###Component###Helper return implode($key); }###GET_CRYPT_KEY### } + diff --git a/admin/compiler/joomla_3/Helper_site.php b/admin/compiler/joomla_3/Helper_site.php index 950ff4d8b..d9069328c 100644 --- a/admin/compiler/joomla_3/Helper_site.php +++ b/admin/compiler/joomla_3/Helper_site.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access');###SITE_POWER_HELPER### ###SITE_HELPER_CLASS_HEADER### @@ -36,7 +36,7 @@ abstract class ###Component###Helper * * @var string */ - public static $langTag;###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT######SITE_POWER_EVENT_HELPER### + public static $langTag;###SITE_GLOBAL_EVENT_HELPER######SITE_CUSTOM_HELPER_SCRIPT######BOTH_CUSTOM_HELPER_SCRIPT### /** * Load the Composer Vendors @@ -1331,3 +1331,4 @@ abstract class ###Component###Helper return implode($key); }###GET_CRYPT_KEY### } + diff --git a/admin/compiler/joomla_3/JCB_Helper.php b/admin/compiler/joomla_3/JCB_Helper.php new file mode 100644 index 000000000..58f2b6458 --- /dev/null +++ b/admin/compiler/joomla_3/JCB_Helper.php @@ -0,0 +1,760 @@ + + * @github 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 file +defined('_JEXEC') or die('Restricted access'); +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die('Restricted access');###ADMIN_POWER_HELPER### + +###ADMIN_HELPER_CLASS_HEADER### + +/** + * ###Component### component helper. + */ +abstract class ###Component###Helper +{ + /** + * Adding the utilities trait to this class + * + * @deprecated 4.0 - Check the trait methods for details, a legacy implementation + */ + use Utilities; + + /** + * Composer Switch + * + * @var array + */ + protected static $composer = array();###ADMIN_GLOBAL_EVENT_HELPER######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 = self::safeString('compose' . $target); + // check if method exist + if (method_exists(__CLASS__, $functionName)) + { + return self::{$functionName}(); + } + return false; + } + return self::$composer[$target]; + } + + /** + * 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 (!self::checkObject(self::$JVersion)) + { + self::$JVersion = new JVersion(); + } + return self::$JVersion; + } + + /** + * Load the Contributors details. + */ + public static function getContributors() + { + // get params + $params = JComponentHelper::getParams('com_###component###'); + // start contributors array + $contributors = array(); + // get all Contributors (max 20) + $searchArray = range('0','20'); + foreach($searchArray as $nr) + { + if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) + { + // set link based of selected option + if($params->get("useContributor".$nr) == 1) + { + $link_front = ''; + $link_back = ''; + } + elseif($params->get("useContributor".$nr) == 2) + { + $link_front = ''; + $link_back = ''; + } + else + { + $link_front = ''; + $link_back = ''; + } + $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + } + } + return $contributors; + }###HELP### + + /** + * Configure the Linkbar. + */ + public static function addSubmenu($submenu) + { + // load user for access menus + $user = JFactory::getUser(); + // load the submenus to sidebar + ###SUBMENU### + }###HELPER_CREATEUSER######HELPER_UIKIT######HELPER_EXEL### + + public static function isPublished($id,$type) + { + if ($type == 'raw') + { + $type = 'item'; + } + $db = JFactory::getDbo(); + $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 = JFactory::getDBO(); + $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 action permissions + * + * @param string $view The related view name + * @param int $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 JObject of permission/authorised actions + * + */ + public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null') + { + // load the user if not given + if (!self::checkObject($user)) + { + // get the user object + $user = JFactory::getUser(); + } + // load the JObject + $result = new JObject; + // make view name safe (just incase) + $view = self::safeString($view); + if (self::checkString($views)) + { + $views = self::safeString($views); + } + // get all actions from component + $actions = JAccess::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', + "/access/section[@name='component']/" + ); + // if non found then return empty JObject + if (empty($actions)) + { + return $result; + } + // get created by if not found + if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + { + $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + } + // set actions only set in component settings + $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); + // check if we have a target + $checkTarget = false; + if ($target) + { + // convert to an array + if (self::checkString($target)) + { + $target = array($target); + } + // check if we are good to go + if (self::checkArray($target)) + { + $checkTarget = true; + } + } + // loop the actions and set the permissions + foreach ($actions as $action) + { + // check target action filter + if ($checkTarget && self::filterActions($view, $action->name, $target)) + { + continue; + } + // set to use component default + $fallback = true; + // reset permission per/action + $permission = false; + $catpermission = false; + // set area + $area = 'comp'; + // check if the record has an ID and the action is item related (not a component action) + if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) + { + // we are in item + $area = 'item'; + // The record has been set. Check the record permissions. + $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id); + // if no permission found, check edit own + if (!$permission) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // the correct target + $coreCheck = (array) explode('.', $action->name); + // check that we have both local and global access + if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) && + $user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + { + // we are in item + $area = 'category'; + // set the core check + $coreCheck = explode('.', $action->name); + $core = $coreCheck[0]; + // make sure we use the core. action check for the categories + if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false ) + { + $coreCheck[0] = 'core'; + $categoryCheck = implode('.', $coreCheck); + } + else + { + $categoryCheck = $action->name; + } + // The record has a category. Check the category permissions. + $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid); + if (!$catpermission && !is_null($catpermission)) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // check that we have both local and global access + if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) && + $user->authorise($core . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + } + } + // if allowed then fallback on component global settings + if ($fallback) + { + // if item/category blocks access then don't fall back on global + if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission)) + { + // do not allow + $result->set($action->name, false); + } + // Finally remember the global settings have the final say. (even if item allow) + // The local item permissions can block, but it can't open and override of global permissions. + // Since items are created by users and global permissions is set by system admin. + else + { + $result->set($action->name, $user->authorise($action->name, 'com_' . $component)); + } + } + } + return $result; + } + + /** + * Filter the action permissions + * + * @param string $action The action to check + * @param array $targets The array of target actions + * + * @return boolean true if action should be filtered out + * + */ + protected static function filterActions(&$view, &$action, &$targets) + { + foreach ($targets as $target) + { + if (strpos($action, $view . '.' . $target) !== false || + strpos($action, 'core.' . $target) !== false) + { + return false; + break; + } + } + return true; + } + + /** + * Get any component's model + */ + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = '###Component###', $config = array()) + { + // fix the name + $name = self::safeString($name); + // full path to models + $fullPathModels = $path . '/models'; + // load the model file + JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + // make sure the table path is loaded + if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + { + // This is the JCB default path to tables in Joomla 3.x + $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + } + // get instance + $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + // if model not found (strange) + if ($model == false) + { + jimport('joomla.filesystem.file'); + // get file path + $filePath = $path . '/' . $name . '.php'; + $fullPathModel = $fullPathModels . '/' . $name . '.php'; + // check if it exists + if (File::exists($filePath)) + { + // get the file + require_once $filePath; + } + elseif (File::exists($fullPathModel)) + { + // get the file + require_once $fullPathModel; + } + // build class names + $modelClass = $Component . 'Model' . $name; + if (class_exists($modelClass)) + { + // initialize the model + return new $modelClass($config); + } + } + return $model; + } + + /** + * Add to asset Table + */ + public static function setAsset($id, $table, $inherit = true) + { + $parent = JTable::getInstance('Asset'); + $parent->loadByName('com_###component###'); + + $parentId = $parent->id; + $name = 'com_###component###.'.$table.'.'.$id; + $title = ''; + + $asset = JTable::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 JAccessRules) + { + $asset->rules = (string) $rules; + } + + if (!$asset->check() || !$asset->store()) + { + JFactory::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 JFactory::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 = JFactory::getDbo(); + $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 = JAccess::getAssetRules($assetId); + if ($result instanceof JAccessRules) + { + $_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 = array(); + } + } + // check if there are any view values remaining + if (count((array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules($_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 null + * + */ + public static function xmlAppend(&$xml, $node) + { + if (!$node) + { + // element was not returned + return; + } + switch (get_class($node)) + { + case 'stdClass': + if (property_exists($node, 'comment')) + { + self::xmlComment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::xmlAppend($xml, $node->fieldXML); + } + break; + case 'SimpleXMLElement': + $domXML = dom_import_simplexml($xml); + $domNode = dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = simplexml_import_dom($domXML); + break; + } + } + + /** + * xmlComment + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param string $comment The comment to inject + * + * @return null + * + */ + public static function xmlComment(&$xml, $comment) + { + $domXML = dom_import_simplexml($xml); + $domComment = new DOMComment($comment); + $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); + $domXML->appendChild($nodeTarget); + $xml = simplexml_import_dom($domXML); + } + + /** + * 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 + * + */ + public static function xmlAddAttributes(&$xml, $attributes = array()) + { + foreach ($attributes as $key => $value) + { + $xml->addAttribute($key, $value); + } + } + + /** + * 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 + * + */ + public static function xmlAddOptions(&$xml, $options = array()) + { + foreach ($options as $key => $value) + { + $addOption = $xml->addChild('option'); + $addOption->addAttribute('value', $key); + $addOption[] = $value; + } + } + + /** + * 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 + * + */ + public static function getFieldObject(&$attributes, $default = '', $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes) && isset($attributes['type'])) + { + // make sure the form helper class is loaded + if (!method_exists('JFormHelper', 'loadFieldType')) + { + jimport('joomla.form.form'); + } + // get field type + $field = JFormHelper::loadFieldType($attributes['type'], true); + // get field xml + $XML = self::getFieldXML($attributes, $options); + // setup the field + $field->setup($XML, $default); + // return the field object + return $field; + } + return false; + } + + /** + * get the field xml + * + * @param array $attributes The array of attributes + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldXML(&$attributes, $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes)) + { + // start field xml + $XML = new SimpleXMLElement(''); + // load the attributes + self::xmlAddAttributes($XML, $attributes); + // check if we have options + if (self::checkArray($options)) + { + // load the options + self::xmlAddOptions($XML, $options); + } + // return the field xml + return $XML; + } + return false; + } + + /** + * 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]) ? self::htmlEscape($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($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]) ? self::htmlEscape($args[3]) : 'JYES', + '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + // return the input + return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + } + + /** + * 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; + } + + // typo sorry! + public static function sorten($string, $length = 40, $addTip = true) + { + return self::shorten($string, $length, $addTip); + }###HELPER_LICENSE_LOCK######GET_CRYPT_KEY### +} diff --git a/admin/compiler/joomla_3/JCB_Helper_site.php b/admin/compiler/joomla_3/JCB_Helper_site.php new file mode 100644 index 000000000..3190e5b48 --- /dev/null +++ b/admin/compiler/joomla_3/JCB_Helper_site.php @@ -0,0 +1,749 @@ + + * @github 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 file +defined('_JEXEC') or die('Restricted access'); +?> +###BOM### + +// No direct access to this file +defined('_JEXEC') or die('Restricted access');###SITE_POWER_HELPER### + +###SITE_HELPER_CLASS_HEADER### + +/** + * ###Component### component helper + */ +abstract class ###Component###Helper +{ + /** + * Adding the utilities trait to this class + * + * @deprecated 4.0 - Check the trait methods for details, a legacy implementation + */ + use Utilities; + + /** + * Composer Switch + * + * @var array + */ + protected static $composer = array();###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 = self::safeString('compose' . $target); + // check if method exist + if (method_exists(__CLASS__, $functionName)) + { + return self::{$functionName}(); + } + return false; + } + return self::$composer[$target]; + } + + /** + * 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 (!self::checkObject(self::$JVersion)) + { + self::$JVersion = new JVersion(); + } + return self::$JVersion; + } + + /** + * Load the Contributors details. + */ + public static function getContributors() + { + // get params + $params = JComponentHelper::getParams('com_###component###'); + // start contributors array + $contributors = array(); + // 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 = ''; + $link_back = ''; + } + elseif($params->get("useContributor".$nr) == 2) + { + $link_front = ''; + $link_back = ''; + } + else + { + $link_front = ''; + $link_back = ''; + } + $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + } + } + return $contributors; + }###HELP_SITE### + + /** + * Get any component's model + */ + public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component = '###Component###', $config = array()) + { + // fix the name + $name = self::safeString($name); + // full path to models + $fullPathModels = $path . '/models'; + // load the model file + JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + // make sure the table path is loaded + if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + { + // This is the JCB default path to tables in Joomla 3.x + $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + } + // get instance + $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + // if model not found (strange) + if ($model == false) + { + jimport('joomla.filesystem.file'); + // get file path + $filePath = $path . '/' . $name . '.php'; + $fullPathModel = $fullPathModels . '/' . $name . '.php'; + // check if it exists + if (File::exists($filePath)) + { + // get the file + require_once $filePath; + } + elseif (File::exists($fullPathModel)) + { + // get the file + require_once $fullPathModel; + } + // build class names + $modelClass = $Component . 'Model' . $name; + if (class_exists($modelClass)) + { + // initialize the model + return new $modelClass($config); + } + } + return $model; + } + + /** + * Add to asset Table + */ + public static function setAsset($id, $table, $inherit = true) + { + $parent = JTable::getInstance('Asset'); + $parent->loadByName('com_###component###'); + + $parentId = $parent->id; + $name = 'com_###component###.'.$table.'.'.$id; + $title = ''; + + $asset = JTable::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 JAccessRules) + { + $asset->rules = (string) $rules; + } + + if (!$asset->check() || !$asset->store()) + { + JFactory::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 JFactory::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 = JFactory::getDbo(); + $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 = JAccess::getAssetRules($assetId); + if ($result instanceof JAccessRules) + { + $_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 = array(); + } + } + // check if there are any view values remaining + if (count((array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules($_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 null + * + */ + public static function xmlAppend(&$xml, $node) + { + if (!$node) + { + // element was not returned + return; + } + switch (get_class($node)) + { + case 'stdClass': + if (property_exists($node, 'comment')) + { + self::xmlComment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::xmlAppend($xml, $node->fieldXML); + } + break; + case 'SimpleXMLElement': + $domXML = dom_import_simplexml($xml); + $domNode = dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = simplexml_import_dom($domXML); + break; + } + } + + /** + * xmlComment + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param string $comment The comment to inject + * + * @return null + * + */ + public static function xmlComment(&$xml, $comment) + { + $domXML = dom_import_simplexml($xml); + $domComment = new DOMComment($comment); + $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); + $domXML->appendChild($nodeTarget); + $xml = simplexml_import_dom($domXML); + } + + /** + * 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 + * + */ + public static function xmlAddAttributes(&$xml, $attributes = array()) + { + foreach ($attributes as $key => $value) + { + $xml->addAttribute($key, $value); + } + } + + /** + * 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 + * + */ + public static function xmlAddOptions(&$xml, $options = array()) + { + foreach ($options as $key => $value) + { + $addOption = $xml->addChild('option'); + $addOption->addAttribute('value', $key); + $addOption[] = $value; + } + } + + /** + * 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 + * + */ + public static function getFieldObject(&$attributes, $default = '', $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes) && isset($attributes['type'])) + { + // make sure the form helper class is loaded + if (!method_exists('JFormHelper', 'loadFieldType')) + { + jimport('joomla.form.form'); + } + // get field type + $field = JFormHelper::loadFieldType($attributes['type'], true); + // get field xml + $XML = self::getFieldXML($attributes, $options); + // setup the field + $field->setup($XML, $default); + // return the field object + return $field; + } + return false; + } + + /** + * get the field xml + * + * @param array $attributes The array of attributes + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldXML(&$attributes, $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes)) + { + // start field xml + $XML = new SimpleXMLElement(''); + // load the attributes + self::xmlAddAttributes($XML, $attributes); + // check if we have options + if (self::checkArray($options)) + { + // load the options + self::xmlAddOptions($XML, $options); + } + // return the field xml + return $XML; + } + return false; + } + + /** + * 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]) ? self::htmlEscape($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($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]) ? self::htmlEscape($args[3]) : 'JYES', + '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + // return the input + return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + }###HELPER_UIKIT######HELPER_CREATEUSER### + + public static function isPublished($id,$type) + { + if ($type == 'raw') + { + $type = 'item'; + } + $db = JFactory::getDbo(); + $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 = JFactory::getDBO(); + $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 action permissions + * + * @param string $view The related view name + * @param int $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 JObject of permission/authorised actions + * + */ + public static function getActions($view, &$record = null, $views = null, $target = null, $component = '###component###', $user = 'null') + { + // load the user if not given + if (!self::checkObject($user)) + { + // get the user object + $user = JFactory::getUser(); + } + // load the JObject + $result = new JObject; + // make view name safe (just incase) + $view = self::safeString($view); + if (self::checkString($views)) + { + $views = self::safeString($views); + } + // get all actions from component + $actions = JAccess::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', + "/access/section[@name='component']/" + ); + // if non found then return empty JObject + if (empty($actions)) + { + return $result; + } + // get created by if not found + if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + { + $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + } + // set actions only set in component settings + $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); + // check if we have a target + $checkTarget = false; + if ($target) + { + // convert to an array + if (self::checkString($target)) + { + $target = array($target); + } + // check if we are good to go + if (self::checkArray($target)) + { + $checkTarget = true; + } + } + // loop the actions and set the permissions + foreach ($actions as $action) + { + // check target action filter + if ($checkTarget && self::filterActions($view, $action->name, $target)) + { + continue; + } + // set to use component default + $fallback = true; + // reset permission per/action + $permission = false; + $catpermission = false; + // set area + $area = 'comp'; + // check if the record has an ID and the action is item related (not a component action) + if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) + { + // we are in item + $area = 'item'; + // The record has been set. Check the record permissions. + $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id); + // if no permission found, check edit own + if (!$permission) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // the correct target + $coreCheck = (array) explode('.', $action->name); + // check that we have both local and global access + if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) && + $user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + { + // we are in item + $area = 'category'; + // set the core check + $coreCheck = explode('.', $action->name); + $core = $coreCheck[0]; + // make sure we use the core. action check for the categories + if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false ) + { + $coreCheck[0] = 'core'; + $categoryCheck = implode('.', $coreCheck); + } + else + { + $categoryCheck = $action->name; + } + // The record has a category. Check the category permissions. + $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid); + if (!$catpermission && !is_null($catpermission)) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // check that we have both local and global access + if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) && + $user->authorise($core . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + } + } + // if allowed then fallback on component global settings + if ($fallback) + { + // if item/category blocks access then don't fall back on global + if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission)) + { + // do not allow + $result->set($action->name, false); + } + // Finally remember the global settings have the final say. (even if item allow) + // The local item permissions can block, but it can't open and override of global permissions. + // Since items are created by users and global permissions is set by system admin. + else + { + $result->set($action->name, $user->authorise($action->name, 'com_' . $component)); + } + } + } + return $result; + } + + /** + * Filter the action permissions + * + * @param string $action The action to check + * @param array $targets The array of target actions + * + * @return boolean true if action should be filtered out + * + */ + protected static function filterActions(&$view, &$action, &$targets) + { + foreach ($targets as $target) + { + if (strpos($action, $view . '.' . $target) !== false || + strpos($action, 'core.' . $target) !== false) + { + return false; + break; + } + } + return true; + } + + /** + * 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; + } + + // typo sorry! + public static function sorten($string, $length = 40, $addTip = true) + { + return self::shorten($string, $length, $addTip); + }###HELPER_SITE_LICENSE_LOCK######GET_CRYPT_KEY### +} diff --git a/admin/compiler/joomla_3/JViewLegacy_custom_admin.php b/admin/compiler/joomla_3/JViewLegacy_custom_admin.php index d0fe52b18..8f3201187 100644 --- a/admin/compiler/joomla_3/JViewLegacy_custom_admin.php +++ b/admin/compiler/joomla_3/JViewLegacy_custom_admin.php @@ -63,10 +63,10 @@ class ###Component###View###SView### extends JViewLegacy JToolbarHelper::title($title,'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS### // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###sviews###'); - if (###Component###Helper::checkString($help_url)) + $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); + if (###Component###Helper::checkString($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/compiler/joomla_3/JViewLegacy_import.php b/admin/compiler/joomla_3/JViewLegacy_import.php index 853c4cb75..3371eace3 100644 --- a/admin/compiler/joomla_3/JViewLegacy_import.php +++ b/admin/compiler/joomla_3/JViewLegacy_import.php @@ -89,10 +89,10 @@ class ###Component###ViewImport extends JViewLegacy } // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('import'); - if (###Component###Helper::checkString($help_url)) + $this->help_url = ###Component###Helper::getHelpUrl('import'); + if (###Component###Helper::checkString($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } } } diff --git a/admin/compiler/joomla_3/JViewLegacy_import_custom.php b/admin/compiler/joomla_3/JViewLegacy_import_custom.php index e540e6e31..f8b56738c 100644 --- a/admin/compiler/joomla_3/JViewLegacy_import_custom.php +++ b/admin/compiler/joomla_3/JViewLegacy_import_custom.php @@ -37,10 +37,10 @@ class ###Component###View###View### extends JViewLegacy } // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###view###'); - if (###Component###Helper::checkString($help_url)) + $this->help_url = ###Component###Helper::getHelpUrl('###view###'); + if (###Component###Helper::checkString($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } } } diff --git a/admin/compiler/joomla_3/JViewLegacy_list.php b/admin/compiler/joomla_3/JViewLegacy_list.php index 2f2718e14..2b457fe14 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list.php +++ b/admin/compiler/joomla_3/JViewLegacy_list.php @@ -129,10 +129,10 @@ class ###Component###View###Views### extends JViewLegacy }###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST######IMPORTBUTTON### // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###views###'); - if (###Component###Helper::checkString($help_url)) + $this->help_url = ###Component###Helper::getHelpUrl('###views###'); + if (###Component###Helper::checkString($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php b/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php index f128fab13..f56863a6c 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php +++ b/admin/compiler/joomla_3/JViewLegacy_list_custom_admin.php @@ -53,10 +53,10 @@ class ###Component###View###SViews### extends JViewLegacy JToolbarHelper::title(JText::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS### // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###sviews###'); - if (###Component###Helper::checkString($help_url)) + $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); + if (###Component###Helper::checkString($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/compiler/joomla_3/JViewLegacy_list_site.php b/admin/compiler/joomla_3/JViewLegacy_list_site.php index db213620c..7a2410c70 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_list_site.php @@ -49,10 +49,10 @@ class ###Component###View###SViews### extends JViewLegacy {###SITE_CUSTOM_BUTTONS### // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###sviews###'); - if (###Component###Helper::checkString($help_url)) + $this->help_url = ###Component###Helper::getHelpUrl('###sviews###'); + if (###Component###Helper::checkString($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar $this->toolbar = JToolbar::getInstance(); diff --git a/admin/compiler/joomla_3/JViewLegacy_site.php b/admin/compiler/joomla_3/JViewLegacy_site.php index 27473368a..7a7b1e978 100644 --- a/admin/compiler/joomla_3/JViewLegacy_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_site.php @@ -49,10 +49,10 @@ class ###Component###View###SView### extends JViewLegacy {###SITE_CUSTOM_BUTTONS### // set help url for this view if found - $help_url = ###Component###Helper::getHelpUrl('###sview###'); - if (###Component###Helper::checkString($help_url)) + $this->help_url = ###Component###Helper::getHelpUrl('###sview###'); + if (###Component###Helper::checkString($this->help_url)) { - JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar $this->toolbar = JToolbar::getInstance(); diff --git a/admin/compiler/joomla_3/component_admin.php b/admin/compiler/joomla_3/component_admin.php index 374678e29..622b1bde0 100644 --- a/admin/compiler/joomla_3/component_admin.php +++ b/admin/compiler/joomla_3/component_admin.php @@ -32,7 +32,7 @@ $document->addScript('components/com_###component###/assets/js/admin.js'); // require helper files JLoader::register('###Component###Helper', __DIR__ . '/helpers/###component###.php');###HELPER_EMAIL### -JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');###LICENSE_LOCKED_INT######ADMIN_GLOBAL_EVENT######ADMIN_POWER_EVENT### +JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');###LICENSE_LOCKED_INT######ADMIN_GLOBAL_EVENT### // Get an instance of the controller prefixed by ###Component### $controller = JControllerLegacy::getInstance('###Component###'); diff --git a/admin/compiler/joomla_3/component_site.php b/admin/compiler/joomla_3/component_site.php index 86d4616ec..451f984fd 100644 --- a/admin/compiler/joomla_3/component_site.php +++ b/admin/compiler/joomla_3/component_site.php @@ -26,7 +26,7 @@ $document->addScript('components/com_###component###/assets/js/site.js'); // Require helper files JLoader::register('###Component###Helper', __DIR__ . '/helpers/###component###.php');###HELPER_EMAIL### -JLoader::register('###Component###HelperRoute', __DIR__ . '/helpers/route.php');###LICENSE_LOCKED_INT######SITE_GLOBAL_EVENT######SITE_POWER_EVENT### +JLoader::register('###Component###HelperRoute', __DIR__ . '/helpers/route.php');###LICENSE_LOCKED_INT######SITE_GLOBAL_EVENT### // Get an instance of the controller prefixed by ###Component### $controller = JControllerLegacy::getInstance('###Component###'); diff --git a/admin/compiler/joomla_3/settings_componentbuilder.json b/admin/compiler/joomla_3/settings_componentbuilder.json new file mode 100644 index 000000000..f62c27ad6 --- /dev/null +++ b/admin/compiler/joomla_3/settings_componentbuilder.json @@ -0,0 +1,784 @@ +{ + "create": { + "admin": { + "assets": { + "css": "css", + "images": { + "icons": "icons" + }, + "js": "js" + }, + "controllers": "controllers", + "helpers": { + "html": "html" + }, + "language": { + "en-GB": "en-GB" + }, + "layouts": "layouts", + "models": { + "fields": "fields", + "forms": "forms", + "rules": "rules" + }, + "sql": { + "updates": { + "mysql": "mysql" + } + }, + "tables": "tables", + "views": "views" + }, + "site": { + "assets": { + "css": "css", + "images": "images", + "js": "js" + }, + "controllers": "controllers", + "helpers": "helpers", + "language": { + "en-GB": "en-GB" + }, + "layouts": "layouts", + "models": "models", + "views": "views" + }, + "media": { + "css": "css", + "images": "images", + "js": "js" + } + }, + "move": { + "static": { + "access.xml": { + "naam": "access.xml", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "config.xml": { + "naam": "config.xml", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "JControllerLegacy.php": { + "naam": "JControllerLegacy.php", + "path": "c0mp0n3nt/admin", + "rename": "new", + "newName": "controller.php", + "type": "file" + }, + "component.xml": { + "naam": "component.xml", + "path": "c0mp0n3nt/", + "rename": "component", + "type": "file" + }, + "component_admin.php": { + "naam": "component_admin.php", + "path": "c0mp0n3nt/admin", + "rename": "component_admin", + "type": "file" + }, + "admin.css": { + "naam": "admin.css", + "path": "c0mp0n3nt/admin/assets/css", + "rename": false, + "type": "file" + }, + "admin.js": { + "naam": "admin.js", + "path": "c0mp0n3nt/admin/assets/js", + "rename": false, + "type": "file" + }, + "site.css": { + "naam": "site.css", + "path": "c0mp0n3nt/site/assets/css", + "rename": false, + "type": "file" + }, + "site.js": { + "naam": "site.js", + "path": "c0mp0n3nt/site/assets/js", + "rename": false, + "type": "file" + }, + "batch_.php": { + "naam": "batch_.php", + "path": "c0mp0n3nt/admin/helpers/html", + "rename": false, + "type": "file" + }, + "batchselection.php": { + "naam": "batchselection.php", + "path": "c0mp0n3nt/admin/layouts", + "rename": false, + "type": "file" + }, + "component_site.php": { + "naam": "component_site.php", + "path": "c0mp0n3nt/site", + "rename": "component_site", + "type": "file" + }, + "router.php": { + "naam": "router.php", + "path": "c0mp0n3nt/site", + "rename": false, + "type": "file" + }, + "routeHelper.php": { + "naam": "routeHelper.php", + "path": "c0mp0n3nt/site/helpers", + "rename": "new", + "newName": "route.php", + "type": "file" + }, + "JControllerLegacySITE.php": { + "naam": "JControllerLegacySITE.php", + "path": "c0mp0n3nt/site", + "rename": "new", + "newName": "controller.php", + "type": "file" + }, + "Helper.php": { + "naam": "JCB_Helper.php", + "path": "c0mp0n3nt/admin/helpers", + "rename": "JCB_Helper", + "type": "file" + }, + "Helper_site.php": { + "naam": "JCB_Helper_site.php", + "path": "c0mp0n3nt/site/helpers", + "rename": "JCB_Helper_site", + "type": "file" + }, + "Helper_category.php": { + "naam": "Helper_category.php", + "path": "c0mp0n3nt/site/helpers", + "rename": "new", + "newName": "category.php", + "type": "file" + }, + "script.php": { + "naam": "script.php", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "install.mysql.utf8.sql": { + "naam": "install.mysql.utf8.sql", + "path": "c0mp0n3nt/admin/sql", + "rename": false, + "type": "file" + }, + "uninstall.mysql.utf8.sql": { + "naam": "uninstall.mysql.utf8.sql", + "path": "c0mp0n3nt/admin/sql", + "rename": false, + "type": "file" + }, + "headercheck_admin.php": { + "naam": "headercheck_admin.php", + "path": "c0mp0n3nt/admin/helpers", + "rename": "new", + "newName": "headercheck.php", + "type": "file" + }, + "LICENSE.txt": { + "naam": "LICENSE.txt", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "README.txt": { + "naam": "README.txt", + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "file" + }, + "README.md": { + "naam": "README.md", + "path": "c0mp0n3nt/", + "rename": false, + "type": "file" + }, + "headercheck.php": { + "naam": "headercheck.php", + "path": "c0mp0n3nt/site/helpers", + "rename": false, + "type": "file" + }, + "import.gif": { + "naam": "import.gif", + "path": "c0mp0n3nt/admin/assets/images", + "rename": false, + "type": "file" + } + }, + "dynamic": { + "admin": { + "whmcs.php": { + "path": "c0mp0n3nt/admin", + "rename": false, + "type": "whmcs" + }, + "Helper_email.php": { + "path": "c0mp0n3nt/admin/helpers", + "rename": "Helper_", + "type": "emailer" + }, + "DASHJControllerAdmin.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "DASHJControllerAdmin", + "type": "dashboard" + }, + "DASHJModelList.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "DASHJModelList", + "type": "dashboard" + }, + "DASHJViewLagacy.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "dashboard" + }, + "default_vdm.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "dashboard" + }, + "default_main.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "dashboard" + }, + "DASHdefault.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "dashboard" + }, + "dashboard.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": false, + "type": "dashboard" + }, + "filter_forms.xml": { + "path": "c0mp0n3nt/admin/models/forms", + "rename": "filter_forms", + "type": "filter" + }, + "module_forms.xml": { + "path": "c0mp0n3nt/admin/models/forms", + "rename": "module_forms", + "type": "single" + }, + "module_forms.js": { + "path": "c0mp0n3nt/media/js", + "rename": "module_forms", + "type": "single" + }, + "edit.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "single" + }, + "JModelAdmin.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelAdmin", + "type": "single" + }, + "JControllerForm.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerForm", + "type": "single" + }, + "JTable.php": { + "path": "c0mp0n3nt/admin/tables", + "rename": "JTable", + "type": "single" + }, + "submitbutton.js": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": false, + "type": "single" + }, + "JViewLegacy_edit.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "single" + }, + "view.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "view", + "type": "single" + }, + "JControllerAdmin.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerAdmin", + "type": "list" + }, + "JModelList.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelList", + "type": "list" + }, + "views.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "views", + "type": "list" + }, + "JViewLegacy_list.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "list" + }, + "default.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_batch_body.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_batch_footer.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_toolbar.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_head.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_body.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "default_foot.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": false, + "type": "list" + }, + "JFormRule.php": { + "path": "c0mp0n3nt/admin/models/rules", + "rename": "JFormRule", + "type": "rule" + }, + "layout_admin.php": { + "path": "c0mp0n3nt/admin/layouts", + "rename": "layout_admin", + "type": "layout" + }, + "layoutoverride.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutoverride", + "type": "layoutoverride" + }, + "layoutitems.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutitems", + "type": "layoutitems" + }, + "layoutfull.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutfull", + "type": "layoutfull" + }, + "layoutlinkedview.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutlinkedview", + "type": "layoutlinkedview" + }, + "layouttitle.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layouttitle", + "type": "layouttitle" + }, + "layoutpublished.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutpublished", + "type": "layoutpublished" + }, + "layoutmetadata.php": { + "path": "c0mp0n3nt/admin/layouts/VIEW", + "rename": "layoutmetadata", + "type": "layoutmetadata" + }, + "JFormFieldCustom.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldCustom", + "type": "fieldcustom" + }, + "JFormFieldList.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldList", + "type": "fieldlist" + }, + "JFormFieldRadio.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldRadio", + "type": "fieldradio" + }, + "JFormFieldCheckboxes.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldCheckboxes", + "type": "fieldcheckboxes" + }, + "JFormFieldUser.php": { + "path": "c0mp0n3nt/admin/models/fields", + "rename": "JFormFieldUser", + "type": "fielduser" + }, + "JControllerLegacyAjax.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "new", + "newName": "ajax.json.php", + "type": "ajax" + }, + "JModelListAjax.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "new", + "newName": "ajax.php", + "type": "ajax" + }, + "JControllerLegacy_import.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "new", + "newName": "import.php", + "type": "import" + }, + "JModelLegacy_import.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "new", + "newName": "import.php", + "type": "import" + }, + "JViewLegacy_import.php": { + "path": "c0mp0n3nt/admin/views/import", + "rename": "new", + "newName": "view.html.php", + "type": "import" + }, + "default_import.php": { + "path": "c0mp0n3nt/admin/views/import/tmpl", + "rename": "new", + "newName": "default.php", + "type": "import" + }, + "JControllerLegacy_import_custom.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerLegacy_import_custom", + "type": "customimport" + }, + "JModelLegacy_import_custom.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelLegacy_import_custom", + "type": "customimport" + }, + "JViewLegacy_import_custom.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "customimport" + }, + "default_import_custom.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "customimport" + }, + "JControllerLegacyHelp.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "new", + "newName": "help.php", + "type": "help" + }, + "1.0.0.sql": { + "path": "c0mp0n3nt/admin/sql/updates/mysql", + "rename": "1.0.0", + "type": "sql_update" + }, + "update_server.xml": { + "path": "c0mp0n3nt/", + "rename": "update_server", + "type": "update_server" + }, + "viewFile.js": { + "path": "c0mp0n3nt/admin/assets/js", + "rename": "viewFile", + "type": "javascript_file" + } + }, + "site": { + "JViewLegacy_list_site.php": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "list" + }, + "JModelList_site.php": { + "path": "c0mp0n3nt/site/models", + "rename": "JModelList_site", + "type": "list" + }, + "views_site.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "views_site", + "type": "list" + }, + "default_list_site.php": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "list" + }, + "JViewLegacy_site.php": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "single" + }, + "view_site.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "view_site", + "type": "single" + }, + "JModelItem_site.php": { + "path": "c0mp0n3nt/site/models", + "rename": "JModelItem_site", + "type": "single" + }, + "default_site.php": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "single" + }, + "default_site_template.php": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "site_template", + "type": "template" + }, + "layout_site.php": { + "path": "c0mp0n3nt/site/layouts", + "rename": "layout_site", + "type": "layout" + }, + "layoutoverride.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutoverride", + "type": "layoutoverride" + }, + "layoutitems.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutitems", + "type": "layoutitems" + }, + "layoutfull.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutfull", + "type": "layoutfull" + }, + "layoutlinkedview.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutlinkedview", + "type": "layoutlinkedview" + }, + "layouttitle.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layouttitle", + "type": "layouttitle" + }, + "layoutpublished.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutpublished", + "type": "layoutpublished" + }, + "layoutmetadata.php": { + "path": "c0mp0n3nt/site/layouts/VIEW", + "rename": "layoutmetadata", + "type": "layoutmetadata" + }, + "default.xml": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": false, + "type": "menu" + }, + "edit.xml": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": false, + "type": "admin_menu" + }, + "module_forms.xml": { + "path": "c0mp0n3nt/site/models/forms", + "rename": "module_forms", + "type": "edit" + }, + "module_forms.js": { + "path": "c0mp0n3nt/site/models/forms", + "rename": "module_forms", + "type": "edit" + }, + "edit_site.php": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "new", + "newName": "edit.php", + "type": "edit" + }, + "JModelAdmin_site.php": { + "path": "c0mp0n3nt/site/models", + "rename": "JModelAdmin_site", + "type": "edit" + }, + "JControllerForm_site.php": { + "path": "c0mp0n3nt/site/controllers", + "rename": "JControllerForm_site", + "type": "edit" + }, + "submitbutton.js": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": false, + "type": "edit" + }, + "JViewLegacy_edit_site.php": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "edit" + }, + "view_site_edit.css": { + "path": "c0mp0n3nt/site/assets/css", + "rename": "view_site_edit", + "type": "edit" + }, + "JControllerLegacyAjaxSite.php": { + "path": "c0mp0n3nt/site/controllers", + "rename": "new", + "newName": "ajax.json.php", + "type": "ajax" + }, + "JModelListAjaxSite.php": { + "path": "c0mp0n3nt/site/models", + "rename": "new", + "newName": "ajax.php", + "type": "ajax" + }, + "JControllerLegacyHelp_site.php": { + "path": "c0mp0n3nt/site/controllers", + "rename": "new", + "newName": "help.php", + "type": "help" + }, + "JControllerForm_custom_site.php": { + "path": "c0mp0n3nt/site/controllers", + "rename": "JControllerForm_custom_site", + "type": "custom_form" + }, + "submitbutton_site.js": { + "path": "c0mp0n3nt/site/views/VIEW", + "rename": "new", + "newName": "submitbutton.js", + "type": "custom_form" + }, + "Helper_category_view.php": { + "path": "c0mp0n3nt/site/helpers", + "rename": "Helper_category_view", + "type": "category" + }, + "viewFileSite.js": { + "path": "c0mp0n3nt/site/assets/js", + "rename": "viewFileSite", + "type": "javascript_file" + } + }, + "custom_admin": { + "JViewLegacy_list_custom_admin.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "list" + }, + "JModelList_custom_admin.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelList_custom_admin", + "type": "list" + }, + "default_list_custom_admin.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "list" + }, + "JControllerAdmin_custom_admin.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerAdmin_custom_admin", + "type": "list" + }, + "views_custom_admin.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "views_custom_admin", + "type": "list" + }, + "view_custom_admin.css": { + "path": "c0mp0n3nt/admin/assets/css", + "rename": "view_custom_admin", + "type": "single" + }, + "JViewLegacy_custom_admin.php": { + "path": "c0mp0n3nt/admin/views/VIEW", + "rename": "new", + "newName": "view.html.php", + "type": "single" + }, + "JModelItem_custom_admin.php": { + "path": "c0mp0n3nt/admin/models", + "rename": "JModelItem_custom_admin", + "type": "single" + }, + "default_custom_admin.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "new", + "newName": "default.php", + "type": "single" + }, + "JControllerLegacy_custom_admin.php": { + "path": "c0mp0n3nt/admin/controllers", + "rename": "JControllerLegacy_custom_admin", + "type": "single" + }, + "default_custom_admin_template.php": { + "path": "c0mp0n3nt/admin/views/VIEW/tmpl", + "rename": "custom_admin_template", + "type": "template" + }, + "layout_custom_admin.php": { + "path": "c0mp0n3nt/admin/layouts", + "rename": "layout_custom_admin", + "type": "layout" + }, + "viewFileCustomAdmin.js": { + "path": "c0mp0n3nt/admin/assets/js", + "rename": "viewFileCustomAdmin", + "type": "javascript_file" + } + } + } + } +} \ No newline at end of file diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index 06c4e9d02..41aadbf30 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -15,6 +15,12 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\MathHelper; + // Use the component builder autoloader ComponentbuilderHelper::autoLoader(); @@ -145,10 +151,10 @@ class Compiler extends Infusion // set the lang data now $this->setLangFileData(); // set the language notice if it was set - if (ComponentbuilderHelper::checkArray($this->langNot) - || ComponentbuilderHelper::checkArray($this->langSet)) + if (ArrayHelper::check($this->langNot) + || ArrayHelper::check($this->langSet)) { - if (ComponentbuilderHelper::checkArray($this->langNot)) + if (ArrayHelper::check($this->langNot)) { $this->app->enqueueMessage( JText::_('

Language Warning

'), 'Warning' @@ -184,7 +190,7 @@ class Compiler extends Infusion ); } // show languages that were added - if (ComponentbuilderHelper::checkArray($this->langSet)) + if (ArrayHelper::check($this->langSet)) { $this->app->enqueueMessage( JText::_('

Language Notice

'), 'Notice' @@ -275,9 +281,9 @@ class Compiler extends Infusion // if there are plugins zip them $this->zipPlugins(); // do lang mismatch check - if (ComponentbuilderHelper::checkArray($this->langMismatch)) + if (ArrayHelper::check($this->langMismatch)) { - if (ComponentbuilderHelper::checkArray($this->langMatch)) + if (ArrayHelper::check($this->langMatch)) { $mismatch = array_diff( array_unique($this->langMismatch), @@ -290,7 +296,7 @@ class Compiler extends Infusion } // set a notice if we have a mismatch if (isset($mismatch) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $mismatch )) { @@ -317,7 +323,7 @@ class Compiler extends Infusion foreach ($mismatch as $string) { $constant = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString($string, 'U'); + . StringHelper::safe($string, 'U'); $this->app->enqueueMessage( JText::sprintf( 'The Joomla.JText._('%s') language constant for %s does not have a corresponding JText::script('%s') decalaration, please add it.', @@ -328,7 +334,7 @@ class Compiler extends Infusion } } // check if we should add a EXTERNALCODE notice - if (ComponentbuilderHelper::checkArray($this->externalCodeString)) + if (ArrayHelper::check($this->externalCodeString)) { // number of external code strings $externalCount = count($this->externalCodeString); @@ -385,9 +391,9 @@ class Compiler extends Infusion protected function updateFiles() { if (isset($this->newFiles['static']) - && ComponentbuilderHelper::checkArray($this->newFiles['static']) + && ArrayHelper::check($this->newFiles['static']) && isset($this->newFiles['dynamic']) - && ComponentbuilderHelper::checkArray($this->newFiles['dynamic'])) + && ArrayHelper::check($this->newFiles['dynamic'])) { // get the bom file $bom = ComponentbuilderHelper::getFileContents($this->bomPath); @@ -405,7 +411,7 @@ class Compiler extends Infusion foreach ($this->newFiles['dynamic'] as $view => $files) { if (isset($this->fileContentDynamic[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->fileContentDynamic[$view] )) { @@ -429,13 +435,13 @@ class Compiler extends Infusion // free up some memory unset($this->newFiles['dynamic']); // do modules if found - if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + if (ArrayHelper::check($this->joomlaModules)) { foreach ($this->joomlaModules as $module) { - if (ComponentbuilderHelper::checkObject($module) + if (ObjectHelper::check($module) && isset($this->newFiles[$module->key]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->newFiles[$module->key] )) { @@ -445,7 +451,7 @@ class Compiler extends Infusion { // check the config fields if (isset($module->config_fields) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $module->config_fields )) { @@ -467,7 +473,7 @@ class Compiler extends Infusion } // check the fieldsets if (isset($module->form_files) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $module->form_files )) { @@ -510,13 +516,13 @@ class Compiler extends Infusion } } // do plugins if found - if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) + if (ArrayHelper::check($this->joomlaPlugins)) { foreach ($this->joomlaPlugins as $plugin) { - if (ComponentbuilderHelper::checkObject($plugin) + if (ObjectHelper::check($plugin) && isset($this->newFiles[$plugin->key]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->newFiles[$plugin->key] )) { @@ -526,7 +532,7 @@ class Compiler extends Infusion { // check the config fields if (isset($plugin->config_fields) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $plugin->config_fields )) { @@ -548,7 +554,7 @@ class Compiler extends Infusion } // check the fieldsets if (isset($plugin->form_files) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $plugin->form_files )) { @@ -591,13 +597,13 @@ class Compiler extends Infusion } } // do powers if found - if (ComponentbuilderHelper::checkArray($this->powers)) + if (ArrayHelper::check($this->powers)) { foreach ($this->powers as $power) { - if (ComponentbuilderHelper::checkObject($power) + if (ObjectHelper::check($power) && isset($this->newFiles[$power->key]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->newFiles[$power->key] )) { @@ -720,11 +726,11 @@ class Compiler extends Infusion } } // move the modules update server to host - if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + if (ArrayHelper::check($this->joomlaModules)) { foreach ($this->joomlaModules as $module) { - if (ComponentbuilderHelper::checkObject($module) + if (ObjectHelper::check($module) && isset($module->add_update_server) && $module->add_update_server == 1 && isset($module->update_server_target) @@ -735,7 +741,7 @@ class Compiler extends Infusion && isset($module->update_server_xml_path) && File::exists($module->update_server_xml_path) && isset($module->update_server_xml_file_name) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->update_server_xml_file_name )) { @@ -753,11 +759,11 @@ class Compiler extends Infusion } } // move the plugins update server to host - if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) + if (ArrayHelper::check($this->joomlaPlugins)) { foreach ($this->joomlaPlugins as $plugin) { - if (ComponentbuilderHelper::checkObject($plugin) + if (ObjectHelper::check($plugin) && isset($plugin->add_update_server) && $plugin->add_update_server == 1 && isset($plugin->update_server_target) @@ -768,7 +774,7 @@ class Compiler extends Infusion && isset($plugin->update_server_xml_path) && File::exists($plugin->update_server_xml_path) && isset($plugin->update_server_xml_file_name) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $plugin->update_server_xml_file_name )) { @@ -791,7 +797,7 @@ class Compiler extends Infusion { // check if these files have its own config data) if (isset($data['config']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $data['config'] ) && $this->componentData->mvc_versiondate == 1) @@ -981,7 +987,7 @@ class Compiler extends Infusion { // move it to the repo folder if set if (isset($this->repoPath) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->repoPath )) { @@ -1007,11 +1013,11 @@ class Compiler extends Infusion ); // move the modules to local folder repos - if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + if (ArrayHelper::check($this->joomlaModules)) { foreach ($this->joomlaModules as $module) { - if (ComponentbuilderHelper::checkObject($module) + if (ObjectHelper::check($module) && isset($module->file_name)) { $module_context = 'module.' . $module->file_name . '.' @@ -1044,11 +1050,11 @@ class Compiler extends Infusion } } // move the plugins to local folder repos - if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) + if (ArrayHelper::check($this->joomlaPlugins)) { foreach ($this->joomlaPlugins as $plugin) { - if (ComponentbuilderHelper::checkObject($plugin) + if (ObjectHelper::check($plugin) && isset($plugin->file_name)) { $plugin_context = 'plugin.' . $plugin->file_name . '.' @@ -1098,7 +1104,7 @@ class Compiler extends Infusion &$this->componentFolderName, &$this->componentData) ); //create the zip file - if (ComponentbuilderHelper::zip( + if (FileHelper::zip( $this->componentPath, $this->filepath['component'] )) { @@ -1162,15 +1168,15 @@ class Compiler extends Infusion private function zipModules() { - if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + if (ArrayHelper::check($this->joomlaModules)) { foreach ($this->joomlaModules as $module) { - if (ComponentbuilderHelper::checkObject($module) + if (ObjectHelper::check($module) && isset($module->zip_name) - && ComponentbuilderHelper::checkString($module->zip_name) + && StringHelper::check($module->zip_name) && isset($module->folder_path) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->folder_path )) { @@ -1190,7 +1196,7 @@ class Compiler extends Infusion &$this->tempPath, &$module->zip_name, &$module) ); //create the zip file - if (ComponentbuilderHelper::zip( + if (FileHelper::zip( $module->folder_path, $this->filepath['modules'][$module->id] )) @@ -1256,15 +1262,15 @@ class Compiler extends Infusion private function zipPlugins() { - if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) + if (ArrayHelper::check($this->joomlaPlugins)) { foreach ($this->joomlaPlugins as $plugin) { - if (ComponentbuilderHelper::checkObject($plugin) + if (ObjectHelper::check($plugin) && isset($plugin->zip_name) - && ComponentbuilderHelper::checkString($plugin->zip_name) + && StringHelper::check($plugin->zip_name) && isset($plugin->folder_path) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $plugin->folder_path )) { @@ -1284,7 +1290,7 @@ class Compiler extends Infusion &$this->tempPath, &$plugin->zip_name, &$plugin) ); //create the zip file - if (ComponentbuilderHelper::zip( + if (FileHelper::zip( $plugin->folder_path, $this->filepath['plugins'][$plugin->id] )) @@ -1359,9 +1365,9 @@ class Compiler extends Infusion $fingerPrint = array(); if (isset($target['hashtarget'][0]) && $target['hashtarget'][0] > 3 && isset($target['path']) - && ComponentbuilderHelper::checkString($target['path']) + && StringHelper::check($target['path']) && isset($target['hashtarget'][1]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $target['hashtarget'][1] )) { @@ -1400,7 +1406,7 @@ class Compiler extends Infusion ); if (!$found) { - $bites = (int) ComponentbuilderHelper::bcmath( + $bites = (int) MathHelper::bc( 'add', $lineBites[$lineNumber], $bites ); } @@ -1590,14 +1596,14 @@ class Compiler extends Infusion // Add the data fwrite($fpFile, $data); // truncate file at the end of the data that was added - $remove = ComponentbuilderHelper::bcmath( + $remove = MathHelper::bc( 'add', $position, mb_strlen($data, '8bit') ); ftruncate($fpFile, $remove); // check if this was a replacement of data if ($replace) { - $position = ComponentbuilderHelper::bcmath( + $position = MathHelper::bc( 'add', $position, $replace ); } diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index da9328e2d..35c25c8d8 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -15,6 +15,17 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\String\FieldHelper; +use VDM\Joomla\Utilities\String\TypeHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; +use VDM\Joomla\Utilities\String\NamespaceHelper; +use VDM\Joomla\Utilities\String\PluginHelper; /** * Get class as the main compilers class @@ -172,6 +183,13 @@ class Get */ public $componentData; + /** + * The Switch to add Powers data + * + * @var boolean + */ + protected $addPower; + /** * The Powers data * @@ -981,16 +999,16 @@ class Get // set the component ID $this->componentID = (int) $config['component']; // set this components code name - if ($name_code = ComponentbuilderHelper::getVar( + if ($name_code = GetHelper::var( 'joomla_component', $this->componentID, 'id', 'name_code' )) { // set lang prefix - $this->langPrefix = 'COM_' . ComponentbuilderHelper::safeString( + $this->langPrefix = 'COM_' . StringHelper::safe( $name_code, 'U' ); // set component code name - $this->componentCodeName = ComponentbuilderHelper::safeString( + $this->componentCodeName = StringHelper::safe( $name_code ); // set component context @@ -1005,12 +1023,12 @@ class Get 'assets_table_fix', 1 ); $this->addAssetsTableFix = (($add_assets_table_fix - = (int) ComponentbuilderHelper::getVar( + = (int) GetHelper::var( 'joomla_component', $this->componentID, 'id', 'assets_table_fix' )) == 3) ? $global : $add_assets_table_fix; // set if language strings line breaks should be removed - $global = ((int) ComponentbuilderHelper::getVar( + $global = ((int) GetHelper::var( 'joomla_component', $this->componentID, 'id', 'remove_line_breaks' ) == 1) ? true : false; @@ -1020,7 +1038,7 @@ class Get : (((int) $config['remove_line_breaks'] == 1) ? true : $global); // set if placeholders should be added to customcode - $global = ((int) ComponentbuilderHelper::getVar( + $global = ((int) GetHelper::var( 'joomla_component', $this->componentID, 'id', 'add_placeholders' ) == 1) ? true : false; @@ -1028,12 +1046,16 @@ class Get ? false : (((int) $config['placeholders'] == 1) ? true : $global); // set if line numbers should be added to comments - $global = ((int) ComponentbuilderHelper::getVar( + $global = ((int) GetHelper::var( 'joomla_component', $this->componentID, 'id', 'debug_linenr' ) == 1) ? true : false; $this->debugLinenr = ((int) $config['debuglinenr'] == 0) ? false : (((int) $config['debuglinenr'] == 1) ? true : $global); + // set if powers should be added to component (default is true) + $global = true; + $this->addPower = (isset($config['powers']) && (int) $config['powers'] == 0) + ? false : ((isset($config['powers']) && (int) $config['powers'] == 1) ? true : $global); // set the current user $this->user = JFactory::getUser(); // Get a db connection. @@ -1068,8 +1090,8 @@ class Get } // update the version if (!isset($this->componentData->old_component_version) - && (ComponentbuilderHelper::checkArray($this->addSQL) - || ComponentbuilderHelper::checkArray( + && (ArrayHelper::check($this->addSQL) + || ArrayHelper::check( $this->updateSQL ))) { @@ -1207,11 +1229,11 @@ class Get $bucket[$this->hhh . 'component' . $this->hhh] = $this->componentCodeName; $bucket[$this->hhh . 'Component' . $this->hhh] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $this->componentCodeName, 'F' ); $bucket[$this->hhh . 'COMPONENT' . $this->hhh] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $this->componentCodeName, 'U' ); $bucket[$this->bbb . 'component' . $this->ddd] = $bucket[$this->hhh @@ -1224,14 +1246,14 @@ class Get $bucket[$this->bbb . 'LANG_PREFIX' . $this->ddd] = $bucket[$this->hhh . 'LANG_PREFIX' . $this->hhh]; // get the current components overides - if (($_placeholders = ComponentbuilderHelper::getVar( + if (($_placeholders = GetHelper::var( 'component_placeholders', $this->componentID, 'joomla_component', 'addplaceholders' )) !== false - && ComponentbuilderHelper::checkJson($_placeholders)) + && JsonHelper::check($_placeholders)) { $_placeholders = json_decode($_placeholders, true); - if (ComponentbuilderHelper::checkArray($_placeholders)) + if (ArrayHelper::check($_placeholders)) { foreach ($_placeholders as $row) { @@ -1391,18 +1413,18 @@ class Get ); // load the global placeholders - if (ComponentbuilderHelper::checkArray($this->globalPlaceholders)) + if (ArrayHelper::check($this->globalPlaceholders)) { $this->placeholders = $this->globalPlaceholders; } // set component sales name - $component->sales_name = ComponentbuilderHelper::safeString( + $component->sales_name = StringHelper::safe( $component->system_name ); // set the component name_code - $component->name_code = ComponentbuilderHelper::safeString( + $component->name_code = StringHelper::safe( $component->name_code ); @@ -1422,15 +1444,15 @@ class Get $component->{'add' . $addTarget} = (isset( $component->{'add' . $addTarget} ) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $component->{'add' . $addTarget} )) ? json_decode($component->{'add' . $addTarget}, true) : null; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $component->{'add' . $addTarget} )) { if (isset($component->{$targetHere}) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $component->{$targetHere} )) { @@ -1455,19 +1477,19 @@ class Get // set whmcs links if needed if (1 == $component->add_license && (!isset($component->whmcs_buy_link) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $component->whmcs_buy_link ))) { // update with the whmcs url if (isset($component->whmcs_url) - && ComponentbuilderHelper::checkString($component->whmcs_url)) + && StringHelper::check($component->whmcs_url)) { $component->whmcs_buy_link = $component->whmcs_url; } // use the company website elseif (isset($component->website) - && ComponentbuilderHelper::checkString($component->website)) + && StringHelper::check($component->website)) { $component->whmcs_buy_link = $component->website; $component->whmcs_url = rtrim($component->website, '/') @@ -1499,9 +1521,9 @@ class Get // set the addcustommenus data $component->addcustommenus = (isset($component->addcustommenus) - && ComponentbuilderHelper::checkJson($component->addcustommenus)) + && JsonHelper::check($component->addcustommenus)) ? json_decode($component->addcustommenus, true) : null; - if (ComponentbuilderHelper::checkArray($component->addcustommenus)) + if (ArrayHelper::check($component->addcustommenus)) { $component->custommenus = array_values($component->addcustommenus); } @@ -1509,9 +1531,9 @@ class Get // set the sql_tweak data $component->sql_tweak = (isset($component->sql_tweak) - && ComponentbuilderHelper::checkJson($component->sql_tweak)) + && JsonHelper::check($component->sql_tweak)) ? json_decode($component->sql_tweak, true) : null; - if (ComponentbuilderHelper::checkArray($component->sql_tweak)) + if (ArrayHelper::check($component->sql_tweak)) { // build the tweak settings $this->setSqlTweaking( @@ -1519,8 +1541,8 @@ class Get function ($array) { return array_map( function ($value) { - if (!ComponentbuilderHelper::checkArray($value) - && !ComponentbuilderHelper::checkObject( + if (!ArrayHelper::check($value) + && !ObjectHelper::check( $value ) && strval($value) === strval( @@ -1541,9 +1563,9 @@ class Get // set the admin_view data $component->addadmin_views = (isset($component->addadmin_views) - && ComponentbuilderHelper::checkJson($component->addadmin_views)) + && JsonHelper::check($component->addadmin_views)) ? json_decode($component->addadmin_views, true) : null; - if (ComponentbuilderHelper::checkArray($component->addadmin_views)) + if (ArrayHelper::check($component->addadmin_views)) { $this->lang = 'admin'; $this->target = 'admin'; @@ -1571,8 +1593,8 @@ class Get function ($array) { $array = array_map( function ($value) { - if (!ComponentbuilderHelper::checkArray($value) - && !ComponentbuilderHelper::checkObject($value) + if (!ArrayHelper::check($value) + && !ObjectHelper::check($value) && strval($value) === strval(intval($value))) { return (int) $value; @@ -1635,9 +1657,9 @@ class Get } // set the site_view data $component->addsite_views = (isset($component->addsite_views) - && ComponentbuilderHelper::checkJson($component->addsite_views)) + && JsonHelper::check($component->addsite_views)) ? json_decode($component->addsite_views, true) : null; - if (ComponentbuilderHelper::checkArray($component->addsite_views)) + if (ArrayHelper::check($component->addsite_views)) { $this->lang = 'site'; $this->target = 'site'; @@ -1652,8 +1674,8 @@ class Get return array_map( function ($value) { - if (!ComponentbuilderHelper::checkArray($value) - && !ComponentbuilderHelper::checkObject($value) + if (!ArrayHelper::check($value) + && !ObjectHelper::check($value) && strval($value) === strval(intval($value))) { return (int) $value; @@ -1671,10 +1693,10 @@ class Get // set the custom_admin_views data $component->addcustom_admin_views = (isset($component->addcustom_admin_views) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $component->addcustom_admin_views )) ? json_decode($component->addcustom_admin_views, true) : null; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $component->addcustom_admin_views )) { @@ -1691,8 +1713,8 @@ class Get return array_map( function ($value) { - if (!ComponentbuilderHelper::checkArray($value) - && !ComponentbuilderHelper::checkObject($value) + if (!ArrayHelper::check($value) + && !ObjectHelper::check($value) && strval($value) === strval(intval($value))) { return (int) $value; @@ -1709,9 +1731,9 @@ class Get // set the config data $component->addconfig = (isset($component->addconfig) - && ComponentbuilderHelper::checkJson($component->addconfig)) + && JsonHelper::check($component->addconfig)) ? json_decode($component->addconfig, true) : null; - if (ComponentbuilderHelper::checkArray($component->addconfig)) + if (ArrayHelper::check($component->addconfig)) { $component->config = array_map( function ($field) { @@ -1740,9 +1762,9 @@ class Get // set the addcustommenus data $component->addcontributors = (isset($component->addcontributors) - && ComponentbuilderHelper::checkJson($component->addcontributors)) + && JsonHelper::check($component->addcontributors)) ? json_decode($component->addcontributors, true) : null; - if (ComponentbuilderHelper::checkArray($component->addcontributors)) + if (ArrayHelper::check($component->addcontributors)) { $this->addContributors = true; $component->contributors = array_values( @@ -1753,9 +1775,9 @@ class Get // set the addcustommenus data $component->version_update = (isset($component->version_update) - && ComponentbuilderHelper::checkJson($component->version_update)) + && JsonHelper::check($component->version_update)) ? json_decode($component->version_update, true) : null; - if (ComponentbuilderHelper::checkArray($component->version_update)) + if (ArrayHelper::check($component->version_update)) { $component->version_update = array_values( $component->version_update @@ -1771,11 +1793,11 @@ class Get ); if ($old_component || $old_admin_views) { - if (ComponentbuilderHelper::checkObject($old_admin_views)) + if (ObjectHelper::check($old_admin_views)) { // add new views if found if (isset($old_admin_views->addadmin_views) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $old_admin_views->addadmin_views )) { @@ -1785,7 +1807,7 @@ class Get ); } // check if a new version was manualy set - if (ComponentbuilderHelper::checkObject($old_component)) + if (ObjectHelper::check($old_component)) { $old_component_version = preg_replace( '/[^0-9.]+/', '', $old_component->component_version @@ -1836,7 +1858,7 @@ class Get if (isset($component->{'add_css_' . $area}) && $component->{'add_css_' . $area} == 1 && isset($component->{'css_' . $area}) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $component->{'css_' . $area} )) { @@ -1868,7 +1890,7 @@ class Get ) && $component->{'add_' . $scriptMethod . '_' . $scriptType} == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $component->{$scriptMethod . '_' . $scriptType} )) { @@ -1891,7 +1913,7 @@ class Get } // add_php_helper if ($component->add_php_helper_admin == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $component->php_helper_admin )) { @@ -1915,7 +1937,7 @@ class Get unset($component->php_helper); // add_admin_event if ($component->add_admin_event == 1 - && ComponentbuilderHelper::checkString($component->php_admin_event)) + && StringHelper::check($component->php_admin_event)) { $this->lang = 'admin'; // update GUI mapper field @@ -1935,7 +1957,7 @@ class Get unset($component->php_admin_event); // add_php_helper_both if ($component->add_php_helper_both == 1 - && ComponentbuilderHelper::checkString($component->php_helper_both)) + && StringHelper::check($component->php_helper_both)) { $this->lang = 'both'; // update GUI mapper field @@ -1956,7 +1978,7 @@ class Get } // add_php_helper_site if ($component->add_php_helper_site == 1 - && ComponentbuilderHelper::checkString($component->php_helper_site)) + && StringHelper::check($component->php_helper_site)) { $this->lang = 'site'; // update GUI mapper field @@ -1978,7 +2000,7 @@ class Get unset($component->php_helper); // add_site_event if ($component->add_site_event == 1 - && ComponentbuilderHelper::checkString($component->php_site_event)) + && StringHelper::check($component->php_site_event)) { $this->lang = 'site'; // update GUI mapper field @@ -2016,7 +2038,7 @@ class Get } unset($component->sql_uninstall); // bom - if (ComponentbuilderHelper::checkString($component->bom)) + if (StringHelper::check($component->bom)) { $this->bomPath = $this->compilerPath . '/' . $component->bom; } @@ -2042,9 +2064,9 @@ class Get $this->lang = 'admin'; // dashboard methods $component->dashboard_tab = (isset($component->dashboard_tab) - && ComponentbuilderHelper::checkJson($component->dashboard_tab)) + && JsonHelper::check($component->dashboard_tab)) ? json_decode($component->dashboard_tab, true) : null; - if (ComponentbuilderHelper::checkArray($component->dashboard_tab)) + if (ArrayHelper::check($component->dashboard_tab)) { $component->dashboard_tab = array_map( function ($array) { @@ -2060,7 +2082,7 @@ class Get } // add the php of the dashboard if set if (isset($component->php_dashboard_methods) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $component->php_dashboard_methods )) { @@ -2095,7 +2117,7 @@ class Get { // get the server protocol $component->{$server . '_protocol'} - = ComponentbuilderHelper::getVar( + = GetHelper::var( 'server', (int) $component->{$server}, 'id', 'protocol' ); } @@ -2112,7 +2134,7 @@ class Get } // set the ignore folders for repo if found if (isset($component->toignore) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $component->toignore )) { @@ -2134,9 +2156,9 @@ class Get } // get all modules $component->addjoomla_modules = (isset($component->addjoomla_modules) - && ComponentbuilderHelper::checkJson($component->addjoomla_modules)) + && JsonHelper::check($component->addjoomla_modules)) ? json_decode($component->addjoomla_modules, true) : null; - if (ComponentbuilderHelper::checkArray($component->addjoomla_modules)) + if (ArrayHelper::check($component->addjoomla_modules)) { $joomla_modules = array_map( function ($array) use (&$component) { @@ -2155,9 +2177,9 @@ class Get unset($component->addjoomla_modules); // get all plugins $component->addjoomla_plugins = (isset($component->addjoomla_plugins) - && ComponentbuilderHelper::checkJson($component->addjoomla_plugins)) + && JsonHelper::check($component->addjoomla_plugins)) ? json_decode($component->addjoomla_plugins, true) : null; - if (ComponentbuilderHelper::checkArray($component->addjoomla_plugins)) + if (ArrayHelper::check($component->addjoomla_plugins)) { $joomla_plugins = array_map( function ($array) use (&$component) { @@ -2312,7 +2334,7 @@ class Get $view->name_single_code = 'oops_hmm_' . $id; if (isset($view->name_single) && $view->name_single != 'null') { - $view->name_single_code = ComponentbuilderHelper::safeString( + $view->name_single_code = StringHelper::safe( $view->name_single ); } @@ -2321,7 +2343,7 @@ class Get $view->name_list_code = 'oops_hmmm_' . $id; if (isset($view->name_list) && $view->name_list != 'null') { - $view->name_list_code = ComponentbuilderHelper::safeString( + $view->name_list_code = StringHelper::safe( $view->name_list ); } @@ -2381,19 +2403,19 @@ class Get $this->placeholders[$this->hhh . 'views' . $this->hhh] = $view->name_list_code; $this->placeholders[$this->hhh . 'View' . $this->hhh] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $view->name_single, 'F' ); $this->placeholders[$this->hhh . 'Views' . $this->hhh] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $view->name_list, 'F' ); $this->placeholders[$this->hhh . 'VIEW' . $this->hhh] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $view->name_single, 'U' ); $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $view->name_list, 'U' ); $this->placeholders[$this->bbb . 'view' . $this->ddd] @@ -2417,9 +2439,9 @@ class Get // add the tables $view->addtables = (isset($view->addtables) - && ComponentbuilderHelper::checkJson($view->addtables)) + && JsonHelper::check($view->addtables)) ? json_decode($view->addtables, true) : null; - if (ComponentbuilderHelper::checkArray($view->addtables)) + if (ArrayHelper::check($view->addtables)) { $view->tables = array_values($view->addtables); } @@ -2429,9 +2451,9 @@ class Get $this->customTabs[$view->name_single_code] = null; $view->customtabs = (isset($view->customtabs) - && ComponentbuilderHelper::checkJson($view->customtabs)) + && JsonHelper::check($view->customtabs)) ? json_decode($view->customtabs, true) : null; - if (ComponentbuilderHelper::checkArray($view->customtabs)) + if (ArrayHelper::check($view->customtabs)) { // setup custom tabs to global data sets $this->customTabs[$view->name_single_code] = array_map( @@ -2445,21 +2467,21 @@ class Get ); // set the tab name $tab['name'] = (isset($tab['name']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $tab['name'] )) ? $tab['name'] : 'Tab'; // set lang $tab['lang'] = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $tab['view'], 'U' - ) . '_' . ComponentbuilderHelper::safeString( + ) . '_' . StringHelper::safe( $tab['name'], 'U' ); $this->setLangContent( 'both', $tab['lang'], $tab['name'] ); // set code name - $tab['code'] = ComponentbuilderHelper::safeString( + $tab['code'] = StringHelper::safe( $tab['name'] ); // check if the permissions for the tab should be added @@ -2537,7 +2559,7 @@ class Get ); // set the sort key $tab['sortKey'] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $tab['lang_permission_title'] ); } @@ -2551,9 +2573,9 @@ class Get // add the local tabs $view->addtabs = (isset($view->addtabs) - && ComponentbuilderHelper::checkJson($view->addtabs)) + && JsonHelper::check($view->addtabs)) ? json_decode($view->addtabs, true) : null; - if (ComponentbuilderHelper::checkArray($view->addtabs)) + if (ArrayHelper::check($view->addtabs)) { $nr = 1; foreach ($view->addtabs as $tab) @@ -2579,9 +2601,9 @@ class Get unset($view->addtabs); // add permissions $view->addpermissions = (isset($view->addpermissions) - && ComponentbuilderHelper::checkJson($view->addpermissions)) + && JsonHelper::check($view->addpermissions)) ? json_decode($view->addpermissions, true) : null; - if (ComponentbuilderHelper::checkArray($view->addpermissions)) + if (ArrayHelper::check($view->addpermissions)) { $view->permissions = array_values($view->addpermissions); } @@ -2590,9 +2612,9 @@ class Get $view->fields = array(); // set fields $view->addfields = (isset($view->addfields) - && ComponentbuilderHelper::checkJson($view->addfields)) + && JsonHelper::check($view->addfields)) ? json_decode($view->addfields, true) : null; - if (ComponentbuilderHelper::checkArray($view->addfields)) + if (ArrayHelper::check($view->addfields)) { $ignoreFields = array(); // load the field data @@ -2628,7 +2650,7 @@ class Get { // add new fields were added if (isset($old_view->addfields) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $old_view->addfields )) { @@ -2674,7 +2696,7 @@ class Get ); // check if the field changed since the last compilation (default fields never change and are always added) if (!isset($ignoreFields[$field['field']]) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $field['settings']->history )) { @@ -2702,7 +2724,7 @@ class Get } // check if the name changed if (isset($field['settings']->history->xml) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $field['settings']->history->xml )) { @@ -2773,10 +2795,10 @@ class Get if ($old_view = $this->getHistoryWatch('admin_view', $id)) { // check if the view name changed - if (ComponentbuilderHelper::checkString($old_view->name_single)) + if (StringHelper::check($old_view->name_single)) { $this->setUpdateSQL( - ComponentbuilderHelper::safeString( + StringHelper::safe( $old_view->name_single ), $view->name_single_code, 'table_name', $view->name_single_code @@ -2799,7 +2821,7 @@ class Get } // check if there is no history on table engine, and it changed from the default/global elseif (isset($view->{'mysql_table_' . $_mysqlTableKey}) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view->{'mysql_table_' . $_mysqlTableKey} ) && !is_numeric( @@ -2818,18 +2840,18 @@ class Get } // set the conditions $view->addconditions = (isset($view->addconditions) - && ComponentbuilderHelper::checkJson($view->addconditions)) + && JsonHelper::check($view->addconditions)) ? json_decode($view->addconditions, true) : null; - if (ComponentbuilderHelper::checkArray($view->addconditions)) + if (ArrayHelper::check($view->addconditions)) { $view->conditions = array(); $ne = 0; foreach ($view->addconditions as $nr => $conditionValue) { - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $conditionValue['target_field'] ) - && ComponentbuilderHelper::checkArray($view->fields)) + && ArrayHelper::check($view->fields)) { foreach ( $conditionValue['target_field'] as $fieldKey => @@ -2843,19 +2865,19 @@ class Get { // load the field details $required - = ComponentbuilderHelper::getBetween( + = GetHelper::between( $fieldValues['settings']->xml, 'required="', '"' ); $required = ($required === 'true' || $required === '1') ? 'yes' : 'no'; $filter - = ComponentbuilderHelper::getBetween( + = GetHelper::between( $fieldValues['settings']->xml, 'filter="', '"' ); $filter - = ComponentbuilderHelper::checkString( + = StringHelper::check( $filter ) ? $filter : 'none'; // set the field name @@ -2877,7 +2899,7 @@ class Get } // load match field - if (ComponentbuilderHelper::checkArray($view->fields) + if (ArrayHelper::check($view->fields) && isset($conditionValue['match_field'])) { foreach ($view->fields as $fieldValue) @@ -2899,7 +2921,7 @@ class Get if (!ComponentbuilderHelper::fieldCheck($type)) { $conditionValue['match_extends'] - = ComponentbuilderHelper::getBetween( + = GetHelper::between( $fieldValue['settings']->xml, 'extends="', '"' ); @@ -2925,9 +2947,9 @@ class Get $this->listHeadOverRide[$view->name_list_code] = array(); // set the relations $view->addrelations = (isset($view->addrelations) - && ComponentbuilderHelper::checkJson($view->addrelations)) + && JsonHelper::check($view->addrelations)) ? json_decode($view->addrelations, true) : null; - if (ComponentbuilderHelper::checkArray($view->addrelations)) + if (ArrayHelper::check($view->addrelations)) { foreach ($view->addrelations as $nr => $relationsValue) { @@ -2943,7 +2965,7 @@ class Get { // do a dynamic update on the set values if (isset($relationsValue['set']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $relationsValue['set'] )) { @@ -2953,7 +2975,7 @@ class Get } // check that the arrays are set if (!isset($this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']]) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']] )) { @@ -2965,7 +2987,7 @@ class Get = $relationsValue; // load the list joints if (isset($relationsValue['joinfields']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $relationsValue['joinfields'] )) { @@ -2977,7 +2999,7 @@ class Get } // set header over-ride if (isset($relationsValue['column_name']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $relationsValue['column_name'] )) { @@ -2988,10 +3010,10 @@ class Get if ('default' !== $check_column_name) { $column_name_lang = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $view->name_list_code, 'U' ) . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $relationsValue['column_name'], 'U' ); $this->setLangContent( @@ -3011,9 +3033,9 @@ class Get $this->linkedAdminViews[$view->name_single_code] = null; $view->addlinked_views = (isset($view->addlinked_views) - && ComponentbuilderHelper::checkJson($view->addlinked_views)) + && JsonHelper::check($view->addlinked_views)) ? json_decode($view->addlinked_views, true) : null; - if (ComponentbuilderHelper::checkArray($view->addlinked_views)) + if (ArrayHelper::check($view->addlinked_views)) { // setup linked views to global data sets $this->linkedAdminViews[$view->name_single_code] = array_values( @@ -3040,7 +3062,7 @@ class Get { if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 - && ComponentbuilderHelper::checkString($view->$scripter)) + && StringHelper::check($view->$scripter)) { $scripter_target = str_replace( 'javascript_', '', $scripter @@ -3079,7 +3101,7 @@ class Get { if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 - && ComponentbuilderHelper::checkString($view->{$scripter})) + && StringHelper::check($view->{$scripter})) { $this->setCustomScriptBuilder( $view->{$scripter}, @@ -3143,7 +3165,7 @@ class Get foreach ($button_code_array as $button_code_field) { if (isset($view->{$button_code_field}) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view->{$button_code_field} )) { @@ -3165,9 +3187,9 @@ class Get } // set the button array $view->custom_button = (isset($view->custom_button) - && ComponentbuilderHelper::checkJson($view->custom_button)) + && JsonHelper::check($view->custom_button)) ? json_decode($view->custom_button, true) : null; - if (ComponentbuilderHelper::checkArray($view->custom_button)) + if (ArrayHelper::check($view->custom_button)) { $view->custom_buttons = array_values($view->custom_button); } @@ -3234,9 +3256,9 @@ class Get } // check if controller input as been set $view->ajax_input = (isset($view->ajax_input) - && ComponentbuilderHelper::checkJson($view->ajax_input)) + && JsonHelper::check($view->ajax_input)) ? json_decode($view->ajax_input, true) : null; - if (ComponentbuilderHelper::checkArray($view->ajax_input)) + if (ArrayHelper::check($view->ajax_input)) { if ($addAjaxSite) { @@ -3248,7 +3270,7 @@ class Get $this->addAjax = true; unset($view->ajax_input); } - if (ComponentbuilderHelper::checkString($view->php_ajaxmethod)) + if (StringHelper::check($view->php_ajaxmethod)) { // make sure we are still in PHP $guiMapper['type'] = 'php'; @@ -3284,7 +3306,7 @@ class Get && isset($view->alias_builder_type) && 2 == $view->alias_builder_type && isset($view->alias_builder) - && ComponentbuilderHelper::checkJson($view->alias_builder)) + && JsonHelper::check($view->alias_builder)) { // get the aliasFields $alias_fields = (array) json_decode($view->alias_builder, true); @@ -3301,7 +3323,7 @@ class Get } ); // check if all is well - if (ComponentbuilderHelper::checkArray($alias_fields)) + if (ArrayHelper::check($alias_fields)) { // load the field names $this->customAliasBuilder[$view->name_single_code] @@ -3350,7 +3372,7 @@ class Get ) { if (isset($view->{'mysql_table_' . $_mysqlTableKey}) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view->{'mysql_table_' . $_mysqlTableKey} ) && !is_numeric($view->{'mysql_table_' . $_mysqlTableKey})) @@ -3426,10 +3448,10 @@ class Get $view = $this->db->loadObject(); // fix alias to use in code $view->code = $this->uniqueCode( - ComponentbuilderHelper::safeString($view->codename) + StringHelper::safe($view->codename) ); - $view->Code = ComponentbuilderHelper::safeString($view->code, 'F'); - $view->CODE = ComponentbuilderHelper::safeString($view->code, 'U'); + $view->Code = StringHelper::safe($view->code, 'F'); + $view->CODE = StringHelper::safe($view->code, 'U'); // Trigger Event: jcb_ce_onBeforeModelCustomViewData $this->triggerEvent( 'jcb_ce_onBeforeModelCustomViewData', @@ -3477,7 +3499,7 @@ class Get ); // load context if not set if (!isset($view->context) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $view->context )) { @@ -3486,7 +3508,7 @@ class Get else { // always make sure context is a safe string - $view->context = ComponentbuilderHelper::safeString($view->context); + $view->context = StringHelper::safe($view->context); } // load the library if (!isset($this->libManager[$this->target])) @@ -3498,12 +3520,12 @@ class Get $this->libManager[$this->target][$view->code] = array(); } // make sure json become array - if (ComponentbuilderHelper::checkJson($view->libraries)) + if (JsonHelper::check($view->libraries)) { $view->libraries = json_decode($view->libraries, true); } // if we have an array add it - if (ComponentbuilderHelper::checkArray($view->libraries)) + if (ArrayHelper::check($view->libraries)) { foreach ($view->libraries as $library) { @@ -3585,7 +3607,7 @@ class Get { if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 - && ComponentbuilderHelper::checkString($view->$scripter)) + && StringHelper::check($view->$scripter)) { // css does not get placholders yet if (strpos($scripter, 'css') === false) @@ -3676,9 +3698,9 @@ class Get $setAjax = false; // check if controller input as been set $view->ajax_input = (isset($view->ajax_input) - && ComponentbuilderHelper::checkJson($view->ajax_input)) + && JsonHelper::check($view->ajax_input)) ? json_decode($view->ajax_input, true) : null; - if (ComponentbuilderHelper::checkArray($view->ajax_input)) + if (ArrayHelper::check($view->ajax_input)) { $this->customScriptBuilder[$target]['ajax_controller'][$view->code] = array_values($view->ajax_input); @@ -3686,7 +3708,7 @@ class Get } unset($view->ajax_input); // load the ajax class mathods (if set) - if (ComponentbuilderHelper::checkString($view->php_ajaxmethod)) + if (StringHelper::check($view->php_ajaxmethod)) { // set field $guiMapper['field'] = 'php_ajaxmethod'; @@ -3726,7 +3748,7 @@ class Get foreach ($button_code_array as $button_code_field) { if (isset($view->{$button_code_field}) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view->{$button_code_field} )) { @@ -3742,9 +3764,9 @@ class Get } // set the button array $view->custom_button = (isset($view->custom_button) - && ComponentbuilderHelper::checkJson($view->custom_button)) + && JsonHelper::check($view->custom_button)) ? json_decode($view->custom_button, true) : null; - if (ComponentbuilderHelper::checkArray($view->custom_button)) + if (ArrayHelper::check($view->custom_button)) { $view->custom_buttons = array_values($view->custom_button); } @@ -3840,13 +3862,13 @@ class Get $field->xml = $this->setDynamicValues(json_decode($field->xml)); // check if we have validate (validation rule set) - $validationRule = ComponentbuilderHelper::getBetween( + $validationRule = GetHelper::between( $field->xml, 'validate="', '"' ); - if (ComponentbuilderHelper::checkString($validationRule)) + if (StringHelper::check($validationRule)) { // make sure it is lowercase - $validationRule = ComponentbuilderHelper::safeString( + $validationRule = StringHelper::safe( $validationRule ); // link this field to this validation @@ -3867,7 +3889,7 @@ class Get { // get the class methods for this rule if it exists if ($this->validationRules[$validationRule] - = ComponentbuilderHelper::getVar( + = GetHelper::var( 'validation_rule', $validationRule, 'name', 'php' )) @@ -3885,7 +3907,7 @@ class Get array( 'table' => 'validation_rule', 'field' => 'php', - 'id' => ComponentbuilderHelper::getVar( + 'id' => GetHelper::var( 'validation_rule', $validationRule, 'name', 'id' ), @@ -3909,9 +3931,9 @@ class Get // load the type values form type params $field->properties = (isset($field->properties) - && ComponentbuilderHelper::checkJson($field->properties)) + && JsonHelper::check($field->properties)) ? json_decode($field->properties, true) : null; - if (ComponentbuilderHelper::checkArray($field->properties)) + if (ArrayHelper::check($field->properties)) { $field->properties = array_values($field->properties); } @@ -3938,15 +3960,15 @@ class Get } // check if we have better encryption elseif (6 == $field->store - && ComponentbuilderHelper::checkString( + && StringHelper::check( $field->on_get_model_field ) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $field->on_save_model_field )) { // add only if string lenght found - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $field->initiator_on_save_model )) { @@ -3963,7 +3985,7 @@ class Get ) ); } - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $field->initiator_on_save_model )) { @@ -4019,12 +4041,12 @@ class Get if ($id > 0 && isset($this->_fieldData[$id])) { // check if we should load scripts for single view - if (ComponentbuilderHelper::checkString($name_single) + if (StringHelper::check($name_single) && !isset($this->customFieldScript[$name_single][$id])) { // add_javascript_view_footer if ($this->_fieldData[$id]->add_javascript_view_footer == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->_fieldData[$id]->javascript_view_footer )) { @@ -4102,12 +4124,12 @@ class Get } } // check if we should load scripts for list views - if (ComponentbuilderHelper::checkString($name_list) + if (StringHelper::check($name_list) && !isset($this->customFieldScript[$name_list][$id])) { // add_javascript_views_footer if ($this->_fieldData[$id]->add_javascript_views_footer == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->_fieldData[$id]->javascript_views_footer )) { @@ -4240,7 +4262,7 @@ class Get } // check if value is array if (isset($field['permission']) - && !ComponentbuilderHelper::checkArray( + && !ArrayHelper::check( $field['permission'] ) && is_numeric($field['permission']) @@ -4334,7 +4356,7 @@ class Get return 'c.title'; } // set the custom code - elseif (ComponentbuilderHelper::checkArray( + elseif (ArrayHelper::check( $field['custom'] )) { @@ -4369,11 +4391,11 @@ class Get } // check that we have the poperties if (isset($field['settings']) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $field['settings'] ) && isset($field['settings']->properties) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $field['settings']->properties )) { @@ -4385,15 +4407,15 @@ class Get $field['settings']->type_name = 'Custom'; } // set the type name - $type_name = ComponentbuilderHelper::safeTypeName( + $type_name = TypeHelper::safe( $field['settings']->type_name ); // if custom (we must use the xml value) if (strtolower($type_name) === 'custom' || strtolower($type_name) === 'customuser') { - $type = ComponentbuilderHelper::safeTypeName( - ComponentbuilderHelper::getBetween( + $type = TypeHelper::safe( + GetHelper::between( $field['settings']->xml, 'type="', '"' ) ); @@ -4408,19 +4430,19 @@ class Get { // force the default value if (isset($property['example']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $property['example'] )) { - $type = ComponentbuilderHelper::safeTypeName( + $type = TypeHelper::safe( $property['example'] ); } // fall back on the xml settings (not ideal) else { - $type = ComponentbuilderHelper::safeTypeName( - ComponentbuilderHelper::getBetween( + $type = TypeHelper::safe( + GetHelper::between( $field['settings']->xml, 'type="', '"' ) ); @@ -4431,7 +4453,7 @@ class Get } } // check if the value is set - if (isset($type) && ComponentbuilderHelper::checkString($type)) + if (isset($type) && StringHelper::check($type)) { return $type; } @@ -4459,7 +4481,7 @@ class Get public function getFieldName(&$field, $listViewName = null, $amicably = '') { // return the unique name if already set - if (ComponentbuilderHelper::checkString($listViewName) + if (StringHelper::check($listViewName) && isset($field['hash']) && isset( $this->uniqueFieldNames[$listViewName . $amicably @@ -4476,13 +4498,13 @@ class Get return 'error'; } // set the type name - $type_name = ComponentbuilderHelper::safeTypeName( + $type_name = TypeHelper::safe( $field['settings']->type_name ); // set the name of the field - $name = ComponentbuilderHelper::safeFieldName($field['settings']->name); + $name = FieldHelper::safe($field['settings']->name); // check that we have the properties - if (ComponentbuilderHelper::checkArray($field['settings']->properties)) + if (ArrayHelper::check($field['settings']->properties)) { foreach ($field['settings']->properties as $property) { @@ -4492,7 +4514,7 @@ class Get if ($type_name === 'category') { // quick check if this is a category linked to view page - $requeSt_id = ComponentbuilderHelper::getBetween( + $requeSt_id = GetHelper::between( $field['settings']->xml, 'name="', '"' ); if (strpos($requeSt_id, '_request_id') !== false @@ -4508,42 +4530,42 @@ class Get $name = 'catid'; } // if list view name is set - if (ComponentbuilderHelper::checkString($listViewName)) + if (StringHelper::check($listViewName)) { // check if we should use another Text Name as this views name $otherName = $this->setPlaceholders( - ComponentbuilderHelper::getBetween( + GetHelper::between( $field['settings']->xml, 'othername="', '"' ), $this->placeholders ); $otherViews = $this->setPlaceholders( - ComponentbuilderHelper::getBetween( + GetHelper::between( $field['settings']->xml, 'views="', '"' ), $this->placeholders ); $otherView = $this->setPlaceholders( - ComponentbuilderHelper::getBetween( + GetHelper::between( $field['settings']->xml, 'view="', '"' ), $this->placeholders ); // This is to link other view category - if (ComponentbuilderHelper::checkString($otherName) - && ComponentbuilderHelper::checkString( + if (StringHelper::check($otherName) + && StringHelper::check( $otherViews ) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $otherView )) { // set other category details $this->catOtherName[$listViewName] = array( - 'name' => ComponentbuilderHelper::safeFieldName( + 'name' => FieldHelper::safe( $otherName ), - 'views' => ComponentbuilderHelper::safeString( + 'views' => StringHelper::safe( $otherViews ), - 'view' => ComponentbuilderHelper::safeString( + 'view' => StringHelper::safe( $otherView ) ); @@ -4563,15 +4585,15 @@ class Get else { // get value from xml - $xml = ComponentbuilderHelper::safeFieldName( + $xml = FieldHelper::safe( $this->setPlaceholders( - ComponentbuilderHelper::getBetween( + GetHelper::between( $field['settings']->xml, 'name="', '"' ), $this->placeholders ) ); // check if a value was found - if (ComponentbuilderHelper::checkString($xml)) + if (StringHelper::check($xml)) { $name = $xml; } @@ -4582,7 +4604,7 @@ class Get } } // return the value unique - if (ComponentbuilderHelper::checkString($listViewName) + if (StringHelper::check($listViewName) && isset($field['hash'])) { $this->uniqueFieldNames[$listViewName . $amicably . $field['hash']] @@ -4643,7 +4665,7 @@ class Get { $counter = 1; // set the unique name - $uniqueName = ComponentbuilderHelper::safeFieldName( + $uniqueName = FieldHelper::safe( $name . '_' . $counter ); while (isset($this->uniqueNames[$view]['names'][$uniqueName])) @@ -4651,7 +4673,7 @@ class Get // increment the number $counter++; // try again - $uniqueName = ComponentbuilderHelper::safeFieldName( + $uniqueName = FieldHelper::safe( $name . '_' . $counter ); } @@ -4677,10 +4699,10 @@ class Get */ public function setGetData($ids, $view_code, $context) { - if (ComponentbuilderHelper::checkArray($ids)) + if (ArrayHelper::check($ids)) { $ids = implode(',', $ids); - if (ComponentbuilderHelper::checkString($ids)) + if (StringHelper::check($ids)) { // Create a new query object. $query = $this->db->getQuery(true); @@ -4712,7 +4734,7 @@ class Get $guiMapper['id'] = (int) $result->id; // add calculations if set if ($result->addcalculation == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $result->php_calculation )) { @@ -4730,7 +4752,7 @@ class Get if (isset($result->add_php_router_parse) && $result->add_php_router_parse == 1 && isset($result->php_router_parse) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $result->php_router_parse )) { @@ -4761,7 +4783,7 @@ class Get if (isset($result->{'add_' . $script}) && $result->{'add_' . $script} == 1 && isset($result->{$script}) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $result->{$script} )) { @@ -4810,7 +4832,7 @@ class Get } } // set the getmethod code name - $result->key = ComponentbuilderHelper::safeString( + $result->key = StringHelper::safe( $view_code . ' ' . $result->name . ' ' . $result->id ); // reset buckets @@ -4870,31 +4892,31 @@ class Get ); // get the table name $_searchQuery - = ComponentbuilderHelper::getBetween( + = GetHelper::between( $customQueryString, '$query->from(', ')' ); - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $_searchQuery ) && strpos($_searchQuery, '#__') !== false) { $_queryName - = ComponentbuilderHelper::getBetween( + = GetHelper::between( $_searchQuery, '#__', "'" ); - if (!ComponentbuilderHelper::checkString( + if (!StringHelper::check( $_queryName )) { $_queryName - = ComponentbuilderHelper::getBetween( + = GetHelper::between( $_searchQuery, '#__', '"' ); } } // set to blank if not found if (!isset($_queryName) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $_queryName )) { @@ -4920,7 +4942,7 @@ class Get $result->join_view_table = json_decode( $result->join_view_table, true ); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $result->join_view_table )) { @@ -4957,7 +4979,7 @@ class Get $result->join_view_table as $nr => &$option ) { - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $option['selection'] )) { @@ -5019,7 +5041,7 @@ class Get $result->join_db_table = json_decode( $result->join_db_table, true ); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $result->join_db_table )) { @@ -5057,7 +5079,7 @@ class Get $result->join_db_table as $nr => &$option1 ) { - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $option1['selection'] )) { @@ -5119,7 +5141,7 @@ class Get $result->filter = json_decode( $result->filter, true ); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $result->filter )) { @@ -5145,7 +5167,7 @@ class Get } // set where details $result->where = json_decode($result->where, true); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $result->where )) { @@ -5168,7 +5190,7 @@ class Get } // set order details $result->order = json_decode($result->order, true); - if (!ComponentbuilderHelper::checkArray( + if (!ArrayHelper::check( $result->order )) { @@ -5176,7 +5198,7 @@ class Get } // set grouping $result->group = json_decode($result->group, true); - if (!ComponentbuilderHelper::checkArray( + if (!ArrayHelper::check( $result->group )) { @@ -5186,7 +5208,7 @@ class Get $result->global = json_decode( $result->global, true ); - if (!ComponentbuilderHelper::checkArray( + if (!ArrayHelper::check( $result->global )) { @@ -5206,7 +5228,7 @@ class Get } // load the events if any is set if ($result->gettype == 1 - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $result->plugin_events )) { @@ -5257,7 +5279,7 @@ class Get ) { // only load if we have a string - if (!ComponentbuilderHelper::checkString($script)) + if (!StringHelper::check($script)) { return false; } @@ -5308,7 +5330,7 @@ class Get $script = $this->setDynamicValues($script); } // check if we still have a string - if (ComponentbuilderHelper::checkString($script)) + if (StringHelper::check($script)) { // now load the placeholder snippet if needed if ($base64 || $dynamic) @@ -5387,7 +5409,7 @@ class Get $script = ''; // check if there is any custom script if (isset($this->customScriptBuilder[$first][$second]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->customScriptBuilder[$first][$second] )) { @@ -5409,7 +5431,7 @@ class Get } } // if not found return default - if (!ComponentbuilderHelper::checkString($script) && $default) + if (!StringHelper::check($script) && $default) { return $default; } @@ -5427,7 +5449,7 @@ class Get */ public function setSqlTweaking($settings) { - if (ComponentbuilderHelper::checkArray($settings)) + if (ArrayHelper::check($settings)) { foreach ($settings as $setting) { @@ -5474,12 +5496,12 @@ class Get } } } - if (ComponentbuilderHelper::checkArray($id_array_new)) + if (ArrayHelper::check($id_array_new)) { $id_array = array_merge($id_array_new, $id_array); } // final fixing to array - if (ComponentbuilderHelper::checkArray($id_array)) + if (ArrayHelper::check($id_array)) { // uniqe $id_array = array_unique($id_array, SORT_NUMERIC); @@ -5518,8 +5540,8 @@ class Get ) { // check if there were new items added - if (ComponentbuilderHelper::checkArray($new) - && ComponentbuilderHelper::checkArray($old)) + if (ArrayHelper::check($new) + && ArrayHelper::check($old)) { // check if this is old repeatable field if (isset($new[$type])) @@ -5528,7 +5550,7 @@ class Get { $newItem = true; // check if this is an id to ignore - if (ComponentbuilderHelper::checkArray($ignore) + if (ArrayHelper::check($ignore) && in_array( $item, $ignore )) @@ -5538,7 +5560,7 @@ class Get } // check if this is old repeatable field elseif (isset($old[$type]) - && ComponentbuilderHelper::checkArray($old[$type])) + && ArrayHelper::check($old[$type])) { if (!in_array($item, $old[$type])) { @@ -5589,7 +5611,7 @@ class Get // search to see if this is a new value $newItem = true; // check if this is an id to ignore - if (ComponentbuilderHelper::checkArray($ignore) + if (ArrayHelper::check($ignore) && in_array($item[$type], $ignore)) { // don't add ignored ids @@ -5597,7 +5619,7 @@ class Get } // check if this is old repeatable field elseif (isset($old[$type]) - && ComponentbuilderHelper::checkArray($old[$type])) + && ArrayHelper::check($old[$type])) { if (in_array($item[$type], $old[$type])) { @@ -5639,14 +5661,14 @@ class Get } } elseif ($key - && ((ComponentbuilderHelper::checkString($new) - && ComponentbuilderHelper::checkString($old)) + && ((StringHelper::check($new) + && StringHelper::check($old)) || (is_numeric($new) && is_numeric($old))) && $new !== $old) { // the string changed, lets add to SQL update if (!isset($this->updateSQL[$type]) - || !ComponentbuilderHelper::checkArray($this->updateSQL[$type])) + || !ArrayHelper::check($this->updateSQL[$type])) { $this->updateSQL[$type] = array(); } @@ -5668,7 +5690,7 @@ class Get { // we have a new item, lets add to SQL if (!isset($this->addSQL[$type]) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->addSQL[$type] )) { @@ -5678,7 +5700,7 @@ class Get if ($key) { if (!isset($this->addSQL[$type][$key]) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->addSQL[$type][$key] )) { @@ -5691,7 +5713,7 @@ class Get // convert adminview id to name if ('adminview' === $type) { - $this->addSQL[$type][] = ComponentbuilderHelper::safeString( + $this->addSQL[$type][] = StringHelper::safe( $this->getAdminViewData($item)->name_single ); } @@ -5802,7 +5824,7 @@ class Get protected function setHistoryWatch($object, $action) { // check the note - if (ComponentbuilderHelper::checkJson($object->version_note)) + if (JsonHelper::check($object->version_note)) { $version_note = json_decode($object->version_note, true); } @@ -5846,7 +5868,7 @@ class Get } // check if we need to still keep this locked if (isset($version_note['component']) - && ComponentbuilderHelper::checkArray($version_note['component'])) + && ArrayHelper::check($version_note['component'])) { // insure component ids are only added once per item $version_note['component'] = array_unique( @@ -5885,34 +5907,34 @@ class Get // to check inside the templates $again = array(); // check if template keys were passed - if (!ComponentbuilderHelper::checkArray($templates)) + if (!ArrayHelper::check($templates)) { // set the Template data - $temp1 = ComponentbuilderHelper::getAllBetween( + $temp1 = GetHelper::allBetween( $default, "\$this->loadTemplate('", "')" ); - $temp2 = ComponentbuilderHelper::getAllBetween( + $temp2 = GetHelper::allBetween( $default, '$this->loadTemplate("', '")' ); - if (ComponentbuilderHelper::checkArray($temp1) - && ComponentbuilderHelper::checkArray($temp2)) + if (ArrayHelper::check($temp1) + && ArrayHelper::check($temp2)) { $templates = array_merge($temp1, $temp2); } else { - if (ComponentbuilderHelper::checkArray($temp1)) + if (ArrayHelper::check($temp1)) { $templates = $temp1; } - elseif (ComponentbuilderHelper::checkArray($temp2)) + elseif (ArrayHelper::check($temp2)) { $templates = $temp2; } } } // check if we found templates - if (ComponentbuilderHelper::checkArray($templates, true)) + if (ArrayHelper::check($templates, true)) { foreach ($templates as $template) { @@ -5924,7 +5946,7 @@ class Get $data = $this->getDataWithAlias( $template, 'template', $view ); - if (ComponentbuilderHelper::checkArray($data)) + if (ArrayHelper::check($data)) { // load it to the template data array $this->templateData[$this->target][$view][$template] @@ -5944,34 +5966,34 @@ class Get } } // check if layout keys were passed - if (!ComponentbuilderHelper::checkArray($layouts)) + if (!ArrayHelper::check($layouts)) { // set the Layout data - $lay1 = ComponentbuilderHelper::getAllBetween( + $lay1 = GetHelper::allBetween( $default, "JLayoutHelper::render('", "'," ); - $lay2 = ComponentbuilderHelper::getAllBetween( + $lay2 = GetHelper::allBetween( $default, 'JLayoutHelper::render("', '",' ); - if (ComponentbuilderHelper::checkArray($lay1) - && ComponentbuilderHelper::checkArray($lay2)) + if (ArrayHelper::check($lay1) + && ArrayHelper::check($lay2)) { $layouts = array_merge($lay1, $lay2); } else { - if (ComponentbuilderHelper::checkArray($lay1)) + if (ArrayHelper::check($lay1)) { $layouts = $lay1; } - elseif (ComponentbuilderHelper::checkArray($lay2)) + elseif (ArrayHelper::check($lay2)) { $layouts = $lay2; } } } // check if we found layouts - if (ComponentbuilderHelper::checkArray($layouts, true)) + if (ArrayHelper::check($layouts, true)) { // get the other target if both $_target = null; @@ -5982,7 +6004,7 @@ class Get foreach ($layouts as $layout) { if (!isset($this->layoutData[$this->target]) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->layoutData[$this->target] ) || !array_key_exists( @@ -5990,7 +6012,7 @@ class Get )) { $data = $this->getDataWithAlias($layout, 'layout', $view); - if (ComponentbuilderHelper::checkArray($data)) + if (ArrayHelper::check($data)) { // load it to the layout data array $this->layoutData[$this->target][$layout] = $data; @@ -6013,7 +6035,7 @@ class Get } } // check again - if (ComponentbuilderHelper::checkArray($again)) + if (ArrayHelper::check($again)) { foreach ($again as $go) { @@ -6074,7 +6096,7 @@ class Get // we load this layout $php_view = ''; if ($row->add_php_view == 1 - && ComponentbuilderHelper::checkString($row->php_view)) + && StringHelper::check($row->php_view)) { $php_view = $this->setGuiCodePlaceholder( $this->setDynamicValues(base64_decode($row->php_view)), @@ -6106,12 +6128,12 @@ class Get $this->libManager[$_target][$view] = array(); } // make sure json become array - if (ComponentbuilderHelper::checkJson($row->libraries)) + if (JsonHelper::check($row->libraries)) { $row->libraries = json_decode($row->libraries, true); } // if we have an array add it - if (ComponentbuilderHelper::checkArray($row->libraries)) + if (ArrayHelper::check($row->libraries)) { foreach ($row->libraries as $library) { @@ -6234,12 +6256,12 @@ class Get $this->db->setQuery($query); $rows = $this->db->loadObjectList(); // check if we have an array - if (ComponentbuilderHelper::checkArray($rows)) + if (ArrayHelper::check($rows)) { foreach ($rows as $row) { // build the key - $k_ey = ComponentbuilderHelper::safeString($row->alias); + $k_ey = StringHelper::safe($row->alias); $key = preg_replace("/[^A-Za-z]/", '', $k_ey); // set the keys $this->dataWithAliasKeys[$table][$row->alias] = $row->id; @@ -6371,7 +6393,7 @@ class Get 6 => array('footableVersion' => 3, 'footable' => true)); if (isset($buildin[$library->id]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $buildin[$library->id] )) { @@ -6404,16 +6426,16 @@ class Get $library->{'add' . $addTarget} = (isset( $library->{'add' . $addTarget} ) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $library->{'add' . $addTarget} )) ? json_decode($library->{'add' . $addTarget}, true) : null; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $library->{'add' . $addTarget} )) { if (isset($library->{$targetHere}) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $library->{$targetHere} )) { @@ -6436,10 +6458,10 @@ class Get { // set the config data $library->addconfig = (isset($library->addconfig) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $library->addconfig )) ? json_decode($library->addconfig, true) : null; - if (ComponentbuilderHelper::checkArray($library->addconfig)) + if (ArrayHelper::check($library->addconfig)) { $library->config = array_map( function ($array) { @@ -6459,7 +6481,7 @@ class Get { // set Needed PHP if (isset($library->php_setdocument) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $library->php_setdocument )) { @@ -6480,10 +6502,10 @@ class Get { // set the addconditions data $library->addconditions = (isset($library->addconditions) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $library->addconditions )) ? json_decode($library->addconditions, true) : null; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $library->addconditions )) { @@ -6534,7 +6556,7 @@ class Get } ); // check if we should continue - if (ComponentbuilderHelper::checkArray($langStringTargets)) + if (ArrayHelper::check($langStringTargets)) { // insure string is not broken $content = $this->setPlaceholders($content, $this->placeholders); @@ -6547,22 +6569,22 @@ class Get // first get the Joomla .JText._() if (in_array('Joomla' . '.JText._(', $langStringTargets)) { - $jsTEXT[] = ComponentbuilderHelper::getAllBetween( + $jsTEXT[] = GetHelper::allBetween( $content, "Joomla" . ".JText._('", "'" ); - $jsTEXT[] = ComponentbuilderHelper::getAllBetween( + $jsTEXT[] = GetHelper::allBetween( $content, 'Joomla' . '.JText._("', '"' ); // combine into one array - $jsTEXT = ComponentbuilderHelper::mergeArrays($jsTEXT); + $jsTEXT = ArrayHelper::merge($jsTEXT); // we need to add a check to insure these JavaScript lang matchup - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $jsTEXT )) //<-- not really needed hmmm { // load the JS text to mismatch array $langCheck[] = $jsTEXT; - $this->langMismatch = ComponentbuilderHelper::mergeArrays( + $this->langMismatch = ArrayHelper::merge( array($jsTEXT, $this->langMismatch) ); } @@ -6570,20 +6592,20 @@ class Get // now get the JText: :script() if (in_array('JText:' . ':script(', $langStringTargets)) { - $scTEXT[] = ComponentbuilderHelper::getAllBetween( + $scTEXT[] = GetHelper::allBetween( $content, "JText:" . ":script('", "'" ); - $scTEXT[] = ComponentbuilderHelper::getAllBetween( + $scTEXT[] = GetHelper::allBetween( $content, 'JText:' . ':script("', '"' ); // combine into one array - $scTEXT = ComponentbuilderHelper::mergeArrays($scTEXT); + $scTEXT = ArrayHelper::merge($scTEXT); // we need to add a check to insure these JavaScript lang matchup - if (ComponentbuilderHelper::checkArray($scTEXT)) + if (ArrayHelper::check($scTEXT)) { // load the Script text to match array $langCheck[] = $scTEXT; - $this->langMatch = ComponentbuilderHelper::mergeArrays( + $this->langMatch = ArrayHelper::merge( array($scTEXT, $this->langMatch) ); } @@ -6591,14 +6613,14 @@ class Get // now do the little trick for JustTEXT: :_('Just uppercase text'); if (in_array('JustTEXT:' . ':_(', $langStringTargets)) { - $langOnly[] = ComponentbuilderHelper::getAllBetween( + $langOnly[] = GetHelper::allBetween( $content, "JustTEXT:" . ":_('", "')" ); - $langOnly[] = ComponentbuilderHelper::getAllBetween( + $langOnly[] = GetHelper::allBetween( $content, 'JustTEXT:' . ':_("', '")' ); // merge lang only - $langOnly = ComponentbuilderHelper::mergeArrays($langOnly); + $langOnly = ArrayHelper::merge($langOnly); } // set language data foreach ($langStringTargets as $langStringTarget) @@ -6610,16 +6632,16 @@ class Get { continue; } - $langCheck[] = ComponentbuilderHelper::getAllBetween( + $langCheck[] = GetHelper::allBetween( $content, $langStringTarget . "'", "'" ); - $langCheck[] = ComponentbuilderHelper::getAllBetween( + $langCheck[] = GetHelper::allBetween( $content, $langStringTarget . '"', '"' ); } // the normal loading of the language strings - $langCheck = ComponentbuilderHelper::mergeArrays($langCheck); - if (ComponentbuilderHelper::checkArray( + $langCheck = ArrayHelper::merge($langCheck); + if (ArrayHelper::check( $langCheck )) //<-- not really needed hmmm { @@ -6646,7 +6668,7 @@ class Get } } // the uppercase loading only (for arrays and other tricks) - if (ComponentbuilderHelper::checkArray($langOnly)) + if (ArrayHelper::check($langOnly)) { foreach ($langOnly as $string) { @@ -6661,7 +6683,7 @@ class Get } } // only continue if we have value to replace - if (ComponentbuilderHelper::checkArray($langHolders)) + if (ArrayHelper::check($langHolders)) { $content = $this->setPlaceholders($content, $langHolders); } @@ -6681,13 +6703,13 @@ class Get public function setLang($string) { // this is there to insure we dont break already added Language strings - if (ComponentbuilderHelper::safeString($string, 'U', '_', false, false) + if (StringHelper::safe($string, 'U', '_', false, false) === $string) { return false; } // build lang key - $keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString( + $keyLang = $this->langPrefix . '_' . StringHelper::safe( $string, 'U' ); // set the language string @@ -6714,7 +6736,7 @@ class Get $as, $row_type, $type ) { - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { if ('db' === $type) { @@ -6754,7 +6776,7 @@ class Get $lines = explode(PHP_EOL, $string); } // only continue if lines are available - if (ComponentbuilderHelper::checkArray($lines)) + if (ArrayHelper::check($lines)) { $gets = array(); $keys = array(); @@ -6787,10 +6809,10 @@ class Get $key = $view . '_' . trim($key); } // continue only if we have get - if (ComponentbuilderHelper::checkString($get)) + if (StringHelper::check($get)) { $gets[] = $this->db->quote($get); - if (ComponentbuilderHelper::checkString($key)) + if (StringHelper::check($key)) { $this->getAsLookup[$method_key][$get] = $key; $keys[] @@ -6810,7 +6832,7 @@ class Get ); } // make sure we have the view name - if (ComponentbuilderHelper::checkString($view)) + if (StringHelper::check($view)) { // prep the field name $field = str_replace($as . '.', '', $get); @@ -6827,8 +6849,8 @@ class Get } } } - if (ComponentbuilderHelper::checkArray($gets) - && ComponentbuilderHelper::checkArray($keys)) + if (ArrayHelper::check($gets) + && ArrayHelper::check($keys)) { // single joined selection needs the prefix to the values to avoid conflict in the names // so we must still add then AS @@ -6879,7 +6901,7 @@ class Get $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); $this->db->setQuery($query); - return ComponentbuilderHelper::safeString($this->db->loadResult()); + return StringHelper::safe($this->db->loadResult()); } /** @@ -6895,7 +6917,7 @@ class Get public function buildSqlDump($tables, $view, $view_id) { // first build a query statment to get all the data (insure it must be added - check the tweaking) - if (ComponentbuilderHelper::checkArray($tables) + if (ArrayHelper::check($tables) && (!isset($this->sqlTweak[$view_id]['remove']) || !$this->sqlTweak[$view_id]['remove'])) { @@ -6914,7 +6936,7 @@ class Get if (strpos($table['sourcemap'], PHP_EOL) !== false) { $fields = explode(PHP_EOL, $table['sourcemap']); - if (ComponentbuilderHelper::checkArray($fields)) + if (ArrayHelper::check($fields)) { // reset array buckets $sourceArray = array(); @@ -6932,10 +6954,10 @@ class Get $targetArray[] = trim($target); } } - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $sourceArray ) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $targetArray )) { @@ -6969,7 +6991,7 @@ class Get if (strpos($table['sourcemap'], PHP_EOL) !== false) { $fields = explode(PHP_EOL, $table['sourcemap']); - if (ComponentbuilderHelper::checkArray($fields)) + if (ArrayHelper::check($fields)) { // reset array buckets $sourceArray = array(); @@ -7004,10 +7026,10 @@ class Get ); } } - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $sourceArray ) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $targetArray )) { @@ -7119,12 +7141,12 @@ class Get public function mysql_escape($value) { // if array then return maped - if (ComponentbuilderHelper::checkArray($value)) + if (ArrayHelper::check($value)) { return array_map(__METHOD__, $value); } // if string make sure it is correctly escaped - if (ComponentbuilderHelper::checkString($value) && !is_numeric($value)) + if (StringHelper::check($value) && !is_numeric($value)) { return $this->db->quote($value); } @@ -7267,7 +7289,7 @@ class Get */ public function setDynamicValues($string, $debug = 0) { - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { $string = $this->setLangStrings( $this->setCustomCodeData( @@ -7306,10 +7328,10 @@ class Get } // target content $bucket = array(); - $found = ComponentbuilderHelper::getAllBetween( + $found = GetHelper::allBetween( $string, '[EXTERNA' . 'LCODE=', ']' ); - if (ComponentbuilderHelper::checkArray($found)) + if (ArrayHelper::check($found)) { // build local bucket foreach ($found as $target) @@ -7365,7 +7387,7 @@ class Get } } // now update local string if bucket has values - if (ComponentbuilderHelper::checkArray($bucket)) + if (ArrayHelper::check($bucket)) { $string = $this->setPlaceholders($string, $bucket); } @@ -7411,7 +7433,7 @@ class Get { // get the data string (code) $this->externalCodeString[$target_key] - = ComponentbuilderHelper::getFileContents($target_url); + = FileHelper::getContent($target_url); // check if we must cut this if (isset($this->externalCodeCutter[$target_key]) && $this->externalCodeCutter[$target_key]) @@ -7423,14 +7445,14 @@ class Get ); } // did we get any value - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $this->externalCodeString[$target_key] )) { // check for changes $live_hash = md5($this->externalCodeString[$target_key]); // check if it exists local - if ($hash = ComponentbuilderHelper::getVar( + if ($hash = GetHelper::var( 'external_code', $target_key, 'target', 'hash' )) { @@ -7562,7 +7584,7 @@ class Get // get the cutting sequence $cutter = (array) explode('|', $sequence); // we only continue if we have more rows than we have to cut - if (array_sum($cutter) < ComponentbuilderHelper::checkArray($rows)) + if (array_sum($cutter) < ArrayHelper::check($rows)) { // remove the rows at the bottom if needed if (isset($cutter[1]) && $cutter[1] > 0) @@ -7618,10 +7640,10 @@ class Get } // the ids found in this content $bucket = array(); - $found = ComponentbuilderHelper::getAllBetween( + $found = GetHelper::allBetween( $string, '[CUSTO' . 'MCODE=', ']' ); - if (ComponentbuilderHelper::checkArray($found)) + if (ArrayHelper::check($found)) { foreach ($found as $key) { @@ -7636,7 +7658,7 @@ class Get { $id = (int) $key; } - elseif (ComponentbuilderHelper::checkString($key) + elseif (StringHelper::check($key) && strpos( $key, '+' ) === false) @@ -7644,7 +7666,7 @@ class Get $getFuncName = trim($key); if (!isset($this->functionNameMemory[$getFuncName])) { - if (!$found_local = ComponentbuilderHelper::getVar( + if (!$found_local = GetHelper::var( 'custom_code', $getFuncName, 'function_name', 'id' )) @@ -7656,7 +7678,7 @@ class Get } $id = (int) $this->functionNameMemory[$getFuncName]; } - elseif (ComponentbuilderHelper::checkString($key) + elseif (StringHelper::check($key) && strpos( $key, '+' ) !== false) @@ -7667,13 +7689,13 @@ class Get { $id = (int) $array[0]; } - elseif (ComponentbuilderHelper::checkString($array[0])) + elseif (StringHelper::check($array[0])) { $getFuncName = trim($array[0]); if (!isset($this->functionNameMemory[$getFuncName])) { if (!$found_local - = ComponentbuilderHelper::getVar( + = GetHelper::var( 'custom_code', $getFuncName, 'function_name', 'id' )) @@ -7712,7 +7734,7 @@ class Get }, (array) explode(',', $array[1]) ); } - elseif (ComponentbuilderHelper::checkString( + elseif (StringHelper::check( $array[1] )) { @@ -7747,7 +7769,7 @@ class Get var_dump($bucket); } // check if any custom code placeholders where found - if (ComponentbuilderHelper::checkArray($bucket)) + if (ArrayHelper::check($bucket)) { $_tmpLang = $this->lang; // insure we add the langs to both site and admin @@ -7824,7 +7846,7 @@ class Get { // check if there is args for this code if (isset($this->customCodeData[$item['id']]['args']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customCodeData[$item['id']]['args'] )) { @@ -7899,7 +7921,7 @@ class Get { // aways fist reset these $this->clearFromPlaceHolders($key); - if (ComponentbuilderHelper::checkArray($values)) + if (ArrayHelper::check($values)) { $number = 0; foreach ($values as $value) @@ -7956,7 +7978,7 @@ class Get '#__componentbuilder_language_translation', 'a' ) ); - if (ComponentbuilderHelper::checkArray($values)) + if (ArrayHelper::check($values)) { $query->select( $this->db->quoteName( @@ -8007,12 +8029,12 @@ class Get // to keep or remove $remove = false; // build the translations - if (ComponentbuilderHelper::checkString($string) + if (StringHelper::check($string) && isset($this->multiLangString[$string])) { // make sure we have converted the string to array if (isset($this->multiLangString[$string]['translation']) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $this->multiLangString[$string]['translation'] )) { @@ -8023,7 +8045,7 @@ class Get } // if we have an array continue if (isset($this->multiLangString[$string]['translation']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->multiLangString[$string]['translation'] )) { @@ -8059,14 +8081,14 @@ class Get } } // do the database management - if (ComponentbuilderHelper::checkString($string) + if (StringHelper::check($string) && ($key = array_search($string, $strings)) !== false) { if (isset($this->multiLangString[$string])) { // update the existing placeholder in db $id = $this->multiLangString[$string]['id']; - if (ComponentbuilderHelper::checkJson( + if (JsonHelper::check( $this->multiLangString[$string][$target] )) { @@ -8323,7 +8345,7 @@ class Get $today = JFactory::getDate()->toSql(); foreach ($otherStrings as $item) { - if (ComponentbuilderHelper::checkJson($item[$target])) + if (JsonHelper::check($item[$target])) { $targets = (array) json_decode($item[$target], true); // if component is not found ignore this string, and do nothing @@ -8333,7 +8355,7 @@ class Get // first remove the component from the string unset($targets[$key]); // check if there are more components - if (ComponentbuilderHelper::checkArray($targets)) + if (ArrayHelper::check($targets)) { // just update the string to unlink the current component $this->setUpdateExistingLangStrings( @@ -8356,7 +8378,7 @@ class Get { // just one linked extension type is enough to stop the search if ($action_with_string - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $item[$other_target] )) { @@ -8364,7 +8386,7 @@ class Get $item[$other_target], true ); // check if linked to other extensions - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $other_targets )) { @@ -8375,14 +8397,14 @@ class Get } // check we should just archive or remove string if ($action_with_string - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $item['translation'] )) { $translation = json_decode( $item['translation'], true ); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $translation )) { @@ -8468,7 +8490,7 @@ class Get $query->from( $this->db->quoteName('#__componentbuilder_custom_code', 'a') ); - if (ComponentbuilderHelper::checkArray($ids)) + if (ArrayHelper::check($ids)) { if ($idArray = $this->checkCustomCodeMemory($ids)) { @@ -8593,7 +8615,7 @@ class Get */ protected function getPowers($ids) { - if (ComponentbuilderHelper::checkArray($ids, true)) + if (ArrayHelper::check($ids, true)) { foreach ($ids as $id) { @@ -8610,7 +8632,7 @@ class Get */ public function getPower($id) { - if ($this->setPower($id)) + if ($this->addPower && $this->setPower($id)) { return $this->powers[$id]; } @@ -8662,11 +8684,11 @@ class Get $this->placeholders ); // now set the code_name and class name - $power->code_name = $power->class_name = ComponentbuilderHelper::safeClassFunctionName( + $power->code_name = $power->class_name = ClassfunctionHelper::safe( $power->name ); // set official name - $power->official_name = ComponentbuilderHelper::safeString( + $power->official_name = StringHelper::safe( $power->name, 'W' ); // set namespace @@ -8694,9 +8716,9 @@ class Get // setup the path array $path_array = (array) explode('\\', $power->namespace); // make sure all sub folders in src dir is set and remove all characters that will not work in folders naming - $power->namespace = ComponentbuilderHelper::safeNamespace(str_replace('.', '\\', $power->namespace)); + $power->namespace = NamespaceHelper::safe(str_replace('.', '\\', $power->namespace)); // make sure it has two or more - if (ComponentbuilderHelper::checkArray($path_array) <= 1) + if (ArrayHelper::check($path_array) <= 1) { // we raise an error message $this->app->enqueueMessage( @@ -8750,10 +8772,10 @@ class Get } // make sure the arrays are namespace safe $path_array = array_map(function ($val) { - return ComponentbuilderHelper::safeNamespace($val); + return NamespaceHelper::safe($val); }, $path_array); $namespace_array = array_map(function ($val) { - return ComponentbuilderHelper::safeNamespace($val); + return NamespaceHelper::safe($val); }, $namespace_array); // set the actual class namespace $power->_namespace = implode('\\', $namespace_array); @@ -8763,11 +8785,11 @@ class Get $prefix_folder = implode('.', $path_array); // make sub folders if still found $sub_folder = ''; - if (ComponentbuilderHelper::checkArray($src_array)) + if (ArrayHelper::check($src_array)) { // make sure the arrays are namespace safe $sub_folder = '/' . implode('/', array_map(function ($val) { - return ComponentbuilderHelper::safeNamespace($val); + return NamespaceHelper::safe($val); }, $src_array)); } // now we set the paths @@ -8779,7 +8801,7 @@ class Get $use = array(); // check if we have use selection $power->use_selection = (isset($power->use_selection) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $power->use_selection )) ? json_decode($power->use_selection, true) : null; if ($power->use_selection) @@ -8790,7 +8812,7 @@ class Get } // check if we have load selection $power->load_selection = (isset($power->load_selection) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $power->load_selection )) ? json_decode($power->load_selection, true) : null; if ($power->load_selection) @@ -8805,7 +8827,7 @@ class Get $power->implement_names = array(); // does this implement $power->implements = (isset($power->implements) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $power->implements )) ? json_decode($power->implements, true) : null; if ($power->implements) @@ -8813,7 +8835,7 @@ class Get foreach ($power->implements as $implement) { if ($implement == -1 - && ComponentbuilderHelper::checkString($power->implements_custom)) + && StringHelper::check($power->implements_custom)) { $power->implement_names[] = $this->setPlaceholders( $this->setDynamicValues($power->implements_custom), @@ -8840,7 +8862,7 @@ class Get $power->extends_name = null; // we first check for custom extending options if ($power->extends == -1 - && ComponentbuilderHelper::checkString($power->extends_custom)) + && StringHelper::check($power->extends_custom)) { $power->extends_name = $this->setPlaceholders( $this->setDynamicValues($power->extends_custom), @@ -8881,7 +8903,7 @@ class Get ) . PHP_EOL; } // now add all the extra use statements - if (ComponentbuilderHelper::checkArray($use)) + if (ArrayHelper::check($use)) { foreach (array_unique($use) as $u) { @@ -8897,12 +8919,12 @@ class Get } } // now set the description - $power->description = (ComponentbuilderHelper::checkString($power->description)) ? $this->setPlaceholders( + $power->description = (StringHelper::check($power->description)) ? $this->setPlaceholders( $this->setDynamicValues($power->description), $this->placeholders ) : ''; // add the main code if set - if (ComponentbuilderHelper::checkString($power->main_class_code)) + if (StringHelper::check($power->main_class_code)) { // set GUI mapper field $guiMapper['field'] = 'main_class_code'; @@ -8924,12 +8946,16 @@ class Get return true; } } - // we failed to get the power + // we failed to get the power, // so we raise an error message - $this->app->enqueueMessage( - JText::sprintf('

Power id:%s not found!

', $id), - 'Error' - ); + // only if id exist + if ($id > 0) + { + $this->app->enqueueMessage( + JText::sprintf('

Power id:%s not found!

', $id), + 'Error' + ); + } // let's not try again $this->statePowers[$id] = false; @@ -8977,7 +9003,7 @@ class Get ); // set safe class function name $module->code_name - = ComponentbuilderHelper::safeClassFunctionName( + = ClassfunctionHelper::safe( $module->name ); // set module folder name @@ -9011,15 +9037,15 @@ class Get */ protected function getModuleIDs() { - if (($addjoomla_modules = ComponentbuilderHelper::getVar( + if (($addjoomla_modules = GetHelper::var( 'component_modules', $this->componentID, 'joomla_component', 'addjoomla_modules' )) !== false) { - $addjoomla_modules = (ComponentbuilderHelper::checkJson( + $addjoomla_modules = (JsonHelper::check( $addjoomla_modules )) ? json_decode($addjoomla_modules, true) : null; - if (ComponentbuilderHelper::checkArray($addjoomla_modules)) + if (ArrayHelper::check($addjoomla_modules)) { $joomla_modules = array_filter( array_values($addjoomla_modules), @@ -9034,7 +9060,7 @@ class Get } ); // if we have values we return IDs - if (ComponentbuilderHelper::checkArray($joomla_modules)) + if (ArrayHelper::check($joomla_modules)) { return array_map( function ($array) { @@ -9144,11 +9170,11 @@ class Get ); // set safe class function name $module->code_name - = ComponentbuilderHelper::safeClassFunctionName( + = ClassfunctionHelper::safe( $module->name ); // set official name - $module->official_name = ComponentbuilderHelper::safeString( + $module->official_name = StringHelper::safe( $module->name, 'W' ); // set langPrefix @@ -9197,7 +9223,7 @@ class Get ); // set description (TODO) add description field to module if (!isset($module->description) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $module->description )) { @@ -9246,9 +9272,9 @@ class Get } // get the custom_get $module->custom_get = (isset($module->custom_get) - && ComponentbuilderHelper::checkJson($module->custom_get)) + && JsonHelper::check($module->custom_get)) ? json_decode($module->custom_get, true) : null; - if (ComponentbuilderHelper::checkArray($module->custom_get)) + if (ArrayHelper::check($module->custom_get)) { $module->custom_get = $this->setGetData( $module->custom_get, $module->key, $module->key @@ -9260,12 +9286,12 @@ class Get } // set helper class details if ($module->add_class_helper >= 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->class_helper_code )) { if ($module->add_class_helper_header == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->class_helper_header )) { @@ -9318,7 +9344,7 @@ class Get } // base64 Decode mod_code if (isset($module->mod_code) - && ComponentbuilderHelper::checkString($module->mod_code)) + && StringHelper::check($module->mod_code)) { // set GUI mapper field $guiMapper['field'] = 'mod_code'; @@ -9344,7 +9370,7 @@ class Get } // base64 Decode default header if (isset($module->default_header) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->default_header )) { @@ -9365,7 +9391,7 @@ class Get } // base64 Decode default if (isset($module->default) - && ComponentbuilderHelper::checkString($module->default)) + && StringHelper::check($module->default)) { // set GUI mapper field $guiMapper['field'] = 'default'; @@ -9389,13 +9415,15 @@ class Get $module->form_files = array(); $module->fieldsets_label = array(); $module->fieldsets_paths = array(); + $module->add_rule_path = array(); + $module->add_field_path = array(); // set global fields rule to default component path $module->fields_rules_paths = 1; // set the fields data $module->fields = (isset($module->fields) - && ComponentbuilderHelper::checkJson($module->fields)) + && JsonHelper::check($module->fields)) ? json_decode($module->fields, true) : null; - if (ComponentbuilderHelper::checkArray($module->fields)) + if (ArrayHelper::check($module->fields)) { // ket global key $key = $module->key; @@ -9405,7 +9433,7 @@ class Get foreach ($module->fields as $n => &$form) { if (isset($form['fields']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $form['fields'] )) { @@ -9416,7 +9444,7 @@ class Get ) { if (!isset($form[$dynamic_field]) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $form[$dynamic_field] )) { @@ -9434,7 +9462,7 @@ class Get else { $form[$dynamic_field] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $form[$dynamic_field] ); } @@ -9463,9 +9491,33 @@ class Get // set where to path is pointing $module->fieldsets_paths[$unique] = $form['fields_rules_paths']; + // check for extra rule paths + if (isset($form['addrulepath']) + && ArrayHelper::check($form['addrulepath'])) + { + foreach ($form['addrulepath'] as $add_rule_path) + { + if (StringHelper::check($add_rule_path['path'])) + { + $module->add_rule_path[$unique] = $add_rule_path['path']; + } + } + } + // check for extra field paths + if (isset($form['addfieldpath']) + && ArrayHelper::check($form['addfieldpath'])) + { + foreach ($form['addfieldpath'] as $add_field_path) + { + if (StringHelper::check($add_field_path['path'])) + { + $module->add_field_path[$unique] = $add_field_path['path']; + } + } + } // add the label if set to lang if (isset($form['label']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $form['label'] )) { @@ -9483,13 +9535,13 @@ class Get $field, $key, $key, $unique ); // update the default if set - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $field['custom_value'] ) && isset($field['settings'])) { if (($old_default - = ComponentbuilderHelper::getBetween( + = GetHelper::between( $field['settings']->xml, 'default="', '"', false )) !== false) @@ -9598,16 +9650,16 @@ class Get $module->{'add' . $addTarget} = (isset( $module->{'add' . $addTarget} ) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $module->{'add' . $addTarget} )) ? json_decode($module->{'add' . $addTarget}, true) : null; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $module->{'add' . $addTarget} )) { if (isset($module->{$targetHere}) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $module->{$targetHere} )) { @@ -9636,12 +9688,12 @@ class Get = array(); } // make sure json become array - if (ComponentbuilderHelper::checkJson($module->libraries)) + if (JsonHelper::check($module->libraries)) { $module->libraries = json_decode($module->libraries, true); } // if we have an array add it - if (ComponentbuilderHelper::checkArray($module->libraries)) + if (ArrayHelper::check($module->libraries)) { foreach ($module->libraries as $library) { @@ -9683,7 +9735,7 @@ class Get ) && $module->{'add_' . $scriptMethod . '_' . $scriptType} == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->{$scriptMethod . '_' . $scriptType} )) { @@ -9715,7 +9767,7 @@ class Get } // add_sql if ($module->add_sql == 1 - && ComponentbuilderHelper::checkString($module->sql)) + && StringHelper::check($module->sql)) { $module->sql = $this->setPlaceholders( $this->setDynamicValues(base64_decode($module->sql)), @@ -9729,7 +9781,7 @@ class Get } // add_sql_uninstall if ($module->add_sql_uninstall == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->sql_uninstall )) { @@ -9746,7 +9798,7 @@ class Get } // update the URL of the update_server if set if ($module->add_update_server == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->update_server_url )) { @@ -9767,7 +9819,7 @@ class Get { // get the server protocol $module->{$server . '_protocol'} - = ComponentbuilderHelper::getVar( + = GetHelper::var( 'server', (int) $module->{$server}, 'id', 'protocol' ); } @@ -9898,15 +9950,15 @@ class Get */ protected function getPluginIDs() { - if (($addjoomla_plugins = ComponentbuilderHelper::getVar( + if (($addjoomla_plugins = GetHelper::var( 'component_plugins', $this->componentID, 'joomla_component', 'addjoomla_plugins' )) !== false) { - $addjoomla_plugins = (ComponentbuilderHelper::checkJson( + $addjoomla_plugins = (JsonHelper::check( $addjoomla_plugins )) ? json_decode($addjoomla_plugins, true) : null; - if (ComponentbuilderHelper::checkArray($addjoomla_plugins)) + if (ArrayHelper::check($addjoomla_plugins)) { $joomla_plugins = array_filter( array_values($addjoomla_plugins), @@ -9921,7 +9973,7 @@ class Get } ); // if we have values we return IDs - if (ComponentbuilderHelper::checkArray($joomla_plugins)) + if (ArrayHelper::check($joomla_plugins)) { return array_map( function ($array) { @@ -9982,7 +10034,7 @@ class Get ); // update the name if it has dynamic values $plugin->code_name - = ComponentbuilderHelper::safeClassFunctionName( + = ClassfunctionHelper::safe( $plugin->name ); // set plugin folder name @@ -10110,7 +10162,7 @@ class Get ); // update the name if it has dynamic values $plugin->code_name - = ComponentbuilderHelper::safeClassFunctionName( + = ClassfunctionHelper::safe( $plugin->name ); // set official name @@ -10118,20 +10170,31 @@ class Get $plugin->group . ' - ' . $plugin->name ); // set langPrefix - $this->langPrefix = 'PLG_' . strtoupper($plugin->group) . '_' - . strtoupper($plugin->code_name); + $this->langPrefix + = PluginHelper::safeLangPrefix( + $plugin->code_name, + $plugin->group + ); // set lang prefix $plugin->lang_prefix = $this->langPrefix; // set plugin class name - $plugin->class_name = 'Plg' . ucfirst($plugin->group) . ucfirst( - $plugin->code_name - ); + $plugin->class_name + = PluginHelper::safeClassName( + $plugin->code_name, + $plugin->group + ); // set plugin install class name - $plugin->installer_class_name = 'plg' . ucfirst($plugin->group) - . ucfirst($plugin->code_name) . 'InstallerScript'; + $plugin->installer_class_name + = PluginHelper::safeInstallClassName( + $plugin->code_name, + $plugin->group + ); // set plugin folder name - $plugin->folder_name = 'plg_' . strtolower($plugin->group) . '_' - . strtolower($plugin->code_name); + $plugin->folder_name + = PluginHelper::safeFolderName( + $plugin->code_name, + $plugin->group + ); // set the zip name $plugin->zip_name = $plugin->folder_name . '_v' . str_replace( '.', '_', $plugin->plugin_version @@ -10177,7 +10240,7 @@ class Get $this->placeholders[$this->hhh . 'DESCRIPTION' . $this->hhh] = ''; if (!isset($plugin->description) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $plugin->description )) { @@ -10297,13 +10360,15 @@ class Get $plugin->form_files = array(); $plugin->fieldsets_label = array(); $plugin->fieldsets_paths = array(); + $plugin->add_rule_path = array(); + $plugin->add_field_path = array(); // set global fields rule to default component path $plugin->fields_rules_paths = 1; // set the fields data $plugin->fields = (isset($plugin->fields) - && ComponentbuilderHelper::checkJson($plugin->fields)) + && JsonHelper::check($plugin->fields)) ? json_decode($plugin->fields, true) : null; - if (ComponentbuilderHelper::checkArray($plugin->fields)) + if (ArrayHelper::check($plugin->fields)) { // ket global key $key = $plugin->key; @@ -10313,7 +10378,7 @@ class Get foreach ($plugin->fields as $n => &$form) { if (isset($form['fields']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $form['fields'] )) { @@ -10324,7 +10389,7 @@ class Get ) { if (!isset($form[$dynamic_field]) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $form[$dynamic_field] )) { @@ -10342,7 +10407,7 @@ class Get else { $form[$dynamic_field] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $form[$dynamic_field] ); } @@ -10373,13 +10438,37 @@ class Get = $form['fields_rules_paths']; // add the label if set to lang if (isset($form['label']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $form['label'] )) { $plugin->fieldsets_label[$unique] = $this->setLang($form['label']); } + // check for extra rule paths + if (isset($form['addrulepath']) + && ArrayHelper::check($form['addrulepath'])) + { + foreach ($form['addrulepath'] as $add_rule_path) + { + if (StringHelper::check($add_rule_path['path'])) + { + $plugin->add_rule_path[$unique] = $add_rule_path['path']; + } + } + } + // check for extra field paths + if (isset($form['addfieldpath']) + && ArrayHelper::check($form['addfieldpath'])) + { + foreach ($form['addfieldpath'] as $add_field_path) + { + if (StringHelper::check($add_field_path['path'])) + { + $plugin->add_field_path[$unique] = $add_field_path['path']; + } + } + } // build the fields $form['fields'] = array_map( function ($field) use ($key, $unique) { @@ -10391,13 +10480,13 @@ class Get $field, $key, $key, $unique ); // update the default if set - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $field['custom_value'] ) && isset($field['settings'])) { if (($old_default - = ComponentbuilderHelper::getBetween( + = GetHelper::between( $field['settings']->xml, 'default="', '"', false )) !== false) @@ -10506,16 +10595,16 @@ class Get $plugin->{'add' . $addTarget} = (isset( $plugin->{'add' . $addTarget} ) - && ComponentbuilderHelper::checkJson( + && JsonHelper::check( $plugin->{'add' . $addTarget} )) ? json_decode($plugin->{'add' . $addTarget}, true) : null; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $plugin->{'add' . $addTarget} )) { if (isset($plugin->{$targetHere}) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $plugin->{$targetHere} )) { @@ -10550,7 +10639,7 @@ class Get ) && $plugin->{'add_' . $scriptMethod . '_' . $scriptType} == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $plugin->{$scriptMethod . '_' . $scriptType} )) { @@ -10582,7 +10671,7 @@ class Get } // add_sql if ($plugin->add_sql == 1 - && ComponentbuilderHelper::checkString($plugin->sql)) + && StringHelper::check($plugin->sql)) { $plugin->sql = $this->setPlaceholders( $this->setDynamicValues(base64_decode($plugin->sql)), @@ -10596,7 +10685,7 @@ class Get } // add_sql_uninstall if ($plugin->add_sql_uninstall == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $plugin->sql_uninstall )) { @@ -10613,7 +10702,7 @@ class Get } // update the URL of the update_server if set if ($plugin->add_update_server == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $plugin->update_server_url )) { @@ -10634,7 +10723,7 @@ class Get { // get the server protocol $plugin->{$server . '_protocol'} - = ComponentbuilderHelper::getVar( + = GetHelper::var( 'server', (int) $plugin->{$server}, 'id', 'protocol' ); } @@ -10756,7 +10845,7 @@ class Get } } // check if any ids left to fetch - if (ComponentbuilderHelper::checkArray($ids)) + if (ArrayHelper::check($ids)) { return $ids; } @@ -10863,12 +10952,12 @@ class Get $placeholders = array_flip( $this->globalPlaceholders ); - $placeholders[ComponentbuilderHelper::safeString( + $placeholders[StringHelper::safe( $this->componentCodeName, 'F' ) . 'Helper::'] = $this->bbb . 'Component' . $this->ddd . 'Helper::'; - $placeholders['COM_' . ComponentbuilderHelper::safeString( + $placeholders['COM_' . StringHelper::safe( $this->componentCodeName, 'U' )] = 'COM_' . $this->bbb @@ -10887,7 +10976,7 @@ class Get // get a list of files in the current directory tree (only PHP, JS and XML for now) $files = Folder::files('.', $type, true, true); // check if files found - if (ComponentbuilderHelper::checkArray($files)) + if (ArrayHelper::check($files)) { foreach ($files as $file) { @@ -10896,14 +10985,14 @@ class Get $this->customCodePlaceholders, $placeholders, $today ); // insert new code - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $this->newCustomCode )) { $this->setNewCustomCode(100); } // update existing custom code - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $this->existingCustomCode )) { @@ -10916,12 +11005,12 @@ class Get // change back to Joomla working directory chdir($joomla); // make sure all code is stored - if (ComponentbuilderHelper::checkArray($this->newCustomCode)) + if (ArrayHelper::check($this->newCustomCode)) { $this->setNewCustomCode(); } // update existing custom code - if (ComponentbuilderHelper::checkArray($this->existingCustomCode)) + if (ArrayHelper::check($this->existingCustomCode)) { $this->setExistingCustomCode(); } @@ -11354,7 +11443,7 @@ class Get if (strpos($script, 'HASHSTRING((((') !== false) { // get the strings - $values = ComponentbuilderHelper::getAllBetween( + $values = GetHelper::allBetween( $script, 'HASHSTRING((((', '))))' ); $locker = array(); @@ -11372,7 +11461,7 @@ class Get if (strpos($script, 'HASHFILE((((') !== false) { // get the strings - $values = ComponentbuilderHelper::getAllBetween( + $values = GetHelper::allBetween( $script, 'HASHFILE((((', '))))' ); $locker = array(); @@ -11380,7 +11469,7 @@ class Get foreach ($values as $path) { // we first get the file if it exist - if ($value = ComponentbuilderHelper::getFileContents($path)) + if ($value = FileHelper::getContent($path)) { // now we hash the file content $locker['HASHFILE((((' . $path . '))))'] @@ -11414,7 +11503,7 @@ class Get if (strpos($script, 'LOCKBASE64((((') !== false) { // get the strings - $values = ComponentbuilderHelper::getAllBetween( + $values = GetHelper::allBetween( $script, 'LOCKBASE64((((', '))))' ); $locker = array(); @@ -11448,28 +11537,28 @@ class Get */ public function setGuiCodePlaceholder($string, $config) { - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { if ($this->addPlaceholders && $this->canAddGuiCodePlaceholder( $string ) - && ComponentbuilderHelper::checkArray($config) + && ArrayHelper::check($config) && isset($config['table']) - && ComponentbuilderHelper::checkString($config['table']) + && StringHelper::check($config['table']) && isset($config['field']) - && ComponentbuilderHelper::checkString($config['field']) + && StringHelper::check($config['field']) && isset($config['type']) - && ComponentbuilderHelper::checkString($config['type']) + && StringHelper::check($config['type']) && isset($config['id']) && is_numeric($config['id'])) { // if we have a key we must get the ID if (isset($config['key']) - && ComponentbuilderHelper::checkString($config['key']) + && StringHelper::check($config['key']) && $config['key'] !== 'id') { - if (($id = ComponentbuilderHelper::getVar( + if (($id = GetHelper::var( $config['table'], $config['id'], $config['key'], 'id' )) !== false @@ -11569,19 +11658,19 @@ class Get protected function guiCodeSearch(&$file, &$placeholders, &$today, &$target) { // get file content - $file_conent = ComponentbuilderHelper::getFileContents($file); + $file_conent = FileHelper::getContent($file); $guiCode = array(); // we add a new search for the GUI CODE Blocks - $guiCode[] = ComponentbuilderHelper::getAllBetween( + $guiCode[] = GetHelper::allBetween( $file_conent, '/***[JCB' . 'GUI<>', '/***[/JCBGUI' . '$$$$]***/' ); - $guiCode[] = ComponentbuilderHelper::getAllBetween( + $guiCode[] = GetHelper::allBetween( $file_conent, '' ); - if (($guiCode = ComponentbuilderHelper::mergeArrays($guiCode)) !== false - && ComponentbuilderHelper::checkArray($guiCode, true)) + if (($guiCode = ArrayHelper::merge($guiCode)) !== false + && ArrayHelper::check($guiCode, true)) { foreach ($guiCode as $code) { @@ -11597,9 +11686,9 @@ class Get // set the ID $id = (int) $query[2]; // make the field name save - $field = ComponentbuilderHelper::safeFieldName($query[1]); + $field = FieldHelper::safe($query[1]); // make the table name save - $table = ComponentbuilderHelper::safeString($query[0]); + $table = StringHelper::safe($query[0]); // reverse placeholder as much as we can $code = $this->reversePlaceholders( $code, $placeholders, $target, $id, $field, $table @@ -11637,7 +11726,7 @@ class Get case 1: // beginning of code $i = trim($check[1]); - if (ComponentbuilderHelper::checkString($i)) + if (StringHelper::check($i)) { return $check[1]; } @@ -11645,7 +11734,7 @@ class Get case 2: // end of code $i = trim($check[0]); - if (ComponentbuilderHelper::checkString($i)) + if (StringHelper::check($i)) { return $check[0]; } @@ -11709,7 +11798,7 @@ class Get preg_match_all('!\d+!', $string, $numbers); // return the first number if (isset($numbers[0]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $numbers[0] )) { @@ -11739,7 +11828,7 @@ class Get // get local code if set if ($id > 0 && $code = base64_decode( - ComponentbuilderHelper::getVar($table, $id, 'id', $field) + GetHelper::var($table, $id, 'id', $field) )) { $string = $this->setReverseLangPlaceholders( @@ -11776,7 +11865,7 @@ class Get } ); // check if we should continue - if (ComponentbuilderHelper::checkArray($langStringTargets)) + if (ArrayHelper::check($langStringTargets)) { // start lang holder $langHolders = array(); @@ -11826,23 +11915,23 @@ class Get // set language data foreach ($langStringTargets as $langStringTarget) { - $langCheck[] = ComponentbuilderHelper::getAllBetween( + $langCheck[] = GetHelper::allBetween( $string, $langStringTarget . "'", "'" ); - $langCheck[] = ComponentbuilderHelper::getAllBetween( + $langCheck[] = GetHelper::allBetween( $string, $langStringTarget . "'", "'" ); } // merge arrays - $langArray = ComponentbuilderHelper::mergeArrays($langCheck); + $langArray = ArrayHelper::merge($langCheck); // continue only if strings were found - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $langArray )) //<-- not really needed hmmm { foreach ($langArray as $lang) { - $_keyLang = ComponentbuilderHelper::safeString($lang, 'U'); + $_keyLang = StringHelper::safe($lang, 'U'); // this is there to insure we dont break already added Language strings if ($_keyLang === $lang) { @@ -11896,7 +11985,7 @@ class Get public function setPlaceholders($data, &$placeholder, $action = 1) { // make sure the placeholders is an array - if (!ComponentbuilderHelper::checkArray($placeholder)) + if (!ArrayHelper::check($placeholder)) { // This is an error, (TODO) actualy we need to add a kind of log here to know that this happened return $data; @@ -11939,7 +12028,7 @@ class Get } } // only replace if the data has these placeholder values - if (ComponentbuilderHelper::checkArray($replace)) + if (ArrayHelper::check($replace)) { return str_replace( array_keys($replace), array_values($replace), $data @@ -12091,7 +12180,7 @@ class Get unset($localPaths[$key]); } } - if (ComponentbuilderHelper::checkArray($localPaths)) + if (ArrayHelper::check($localPaths)) { return $localPaths; } diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index 79532517f..e218382cb 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -15,6 +15,12 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\FileHelper; + /** * Structure class @@ -485,7 +491,7 @@ class Structure extends Get */ private function buildPowers() { - if (ComponentbuilderHelper::checkArray($this->powers)) + if (ArrayHelper::check($this->powers)) { // Trigger Event: jcb_ce_onBeforeSetModules $this->triggerEvent( @@ -496,9 +502,9 @@ class Structure extends Get $htaccess = array(); foreach ($this->powers as $power) { - if (ComponentbuilderHelper::checkObject($power) + if (ObjectHelper::check($power) && isset($power->path) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $power->path )) { @@ -594,7 +600,7 @@ class Structure extends Get */ private function buildModules() { - if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + if (ArrayHelper::check($this->joomlaModules)) { // Trigger Event: jcb_ce_onBeforeSetModules $this->triggerEvent( @@ -603,9 +609,9 @@ class Structure extends Get ); foreach ($this->joomlaModules as $module) { - if (ComponentbuilderHelper::checkObject($module) + if (ObjectHelper::check($module) && isset($module->folder_name) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $module->folder_name )) { @@ -764,7 +770,7 @@ class Structure extends Get if (($css = $this->getCustomScriptBuilder( 'css_view', $module->key )) !== null - && ComponentbuilderHelper::checkString($css)) + && StringHelper::check($css)) { // make sure this script does not have PHP if (strpos($css, 'getCustomScriptBuilder( 'view_footer', $module->key )) !== null - && ComponentbuilderHelper::checkString($javascript)) + && StringHelper::check($javascript)) { // make sure this script does not have PHP if (strpos($javascript, 'form_files) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $module->form_files )) { @@ -946,47 +952,81 @@ class Structure extends Get { // default to the field set name $label = $fieldset; - if (isset( - $module->fieldsets_label[$file - . $field_name . $fieldset] - )) + if (isset($module->fieldsets_label[$file . $field_name . $fieldset])) { - $label = $module->fieldsets_label[$file - . $field_name . $fieldset]; + $label = $module->fieldsets_label[$file . $field_name . $fieldset]; } // add path to module rules and custom fields - if (isset( - $module->fieldsets_paths[$file - . $field_name . $fieldset] - ) - && $module->fieldsets_paths[$file - . $field_name . $fieldset] == 2) + if (isset($module->fieldsets_paths[$file . $field_name . $fieldset]) + && ($module->fieldsets_paths[$file . $field_name . $fieldset] == 2 + || $module->fieldsets_paths[$file . $field_name . $fieldset] == 3)) { + if ($module->target == 2) + { + if (!isset($module->add_rule_path[$file . $field_name . $fieldset])) + { + $module->add_rule_path[$file . $field_name . $fieldset] = + '/administrator/modules/' + . $module->file_name . '/rules'; + } + + if (!isset($module->add_field_path[$file . $field_name . $fieldset])) + { + $module->add_field_path[$file . $field_name . $fieldset] = + '/administrator/modules/' + . $module->file_name . '/fields'; + } + } + else + { + if (!isset($module->add_rule_path[$file . $field_name . $fieldset])) + { + $module->add_rule_path[$file . $field_name . $fieldset] = + '/modules/' . $module->file_name + . '/rules'; + } + + if (!isset($module->add_field_path[$file . $field_name . $fieldset])) + { + $module->add_field_path[$file . $field_name . $fieldset] = + '/modules/' . $module->file_name + . '/fields'; + } + } + } + // add path to module rules and custom fields + if (isset($module->add_rule_path[$file . $field_name . $fieldset]) + || isset($module->add_field_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(1) . ''; - $xml .= PHP_EOL . $this->_t(1) - . '
_t(2) - . 'addrulepath="/modules/' - . strtolower($module->code_name) - . '/rules"'; - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/modules/' - . strtolower($module->code_name) - . '/fields"'; + . $this->setLine(__LINE__) . ' default paths of ' + . $fieldset . ' fieldset points to the module -->'; + + $xml .= PHP_EOL . $this->_t(1) . '
add_rule_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addrulepath="' . $module->add_rule_path[$file . $field_name . $fieldset] . '"'; + } + + if (isset($module->add_field_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addfieldpath="' . $module->add_field_path[$file . $field_name . $fieldset] . '"'; + } + $xml .= PHP_EOL . $this->_t(1) . '>'; } else { - $xml .= PHP_EOL . $this->_t(1) - . '
'; + $xml .= PHP_EOL . $this->_t(1) . '
'; } // check if we have an inner field set - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $field_name_inner )) { @@ -998,7 +1038,7 @@ class Structure extends Get $xml .= $this->hhh . 'FIELDSET_' . $file . $field_name . $fieldset . $this->hhh; // check if we have an inner field set - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $field_name_inner )) { @@ -1057,7 +1097,7 @@ class Structure extends Get ); // check if this lib has files if (isset($module->files) - && ComponentbuilderHelper::checkArray($module->files)) + && ArrayHelper::check($module->files)) { // add to component files foreach ($module->files as $file) @@ -1070,7 +1110,7 @@ class Structure extends Get } // check if this lib has folders if (isset($module->folders) - && ComponentbuilderHelper::checkArray($module->folders)) + && ArrayHelper::check($module->folders)) { // add to component folders foreach ($module->folders as $folder) @@ -1083,7 +1123,7 @@ class Structure extends Get } // check if this module has urls if (isset($module->urls) - && ComponentbuilderHelper::checkArray($module->urls)) + && ArrayHelper::check($module->urls)) { // add to component urls foreach ($module->urls as $n => &$url) @@ -1091,14 +1131,14 @@ class Structure extends Get // should we add the local folder if (isset($url['type']) && $url['type'] > 1 && isset($url['url']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $url['url'] )) { // set file name $fileName = basename($url['url']); // get the file contents - $data = ComponentbuilderHelper::getFileContents( + $data = FileHelper::getContent( $url['url'] ); // build sub path @@ -1141,7 +1181,7 @@ class Structure extends Get */ private function buildPlugins() { - if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) + if (ArrayHelper::check($this->joomlaPlugins)) { // Trigger Event: jcb_ce_onBeforeSetPlugins $this->triggerEvent( @@ -1150,9 +1190,9 @@ class Structure extends Get ); foreach ($this->joomlaPlugins as $plugin) { - if (ComponentbuilderHelper::checkObject($plugin) + if (ObjectHelper::check($plugin) && isset($plugin->folder_name) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $plugin->folder_name )) { @@ -1239,7 +1279,7 @@ class Structure extends Get } // set forms folder if needed if (isset($plugin->form_files) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $plugin->form_files )) { @@ -1321,49 +1361,63 @@ class Structure extends Get { // default to the field set name $label = $fieldset; - if (isset( - $plugin->fieldsets_label[$file - . $field_name . $fieldset] - )) + if (isset($plugin->fieldsets_label[$file . $field_name . $fieldset])) { - $label = $plugin->fieldsets_label[$file - . $field_name . $fieldset]; + $label = $plugin->fieldsets_label[$file . $field_name . $fieldset]; } // add path to plugin rules and custom fields - if (isset( - $plugin->fieldsets_paths[$file - . $field_name . $fieldset] - ) - && $plugin->fieldsets_paths[$file - . $field_name . $fieldset] == 2) + if (isset($plugin->fieldsets_paths[$file . $field_name . $fieldset]) + && ($plugin->fieldsets_paths[$file . $field_name . $fieldset] == 2 + || $plugin->fieldsets_paths[$file . $field_name . $fieldset] == 3)) + { + if (!isset($plugin->add_rule_path[$file . $field_name . $fieldset])) + { + $plugin->add_rule_path[$file . $field_name . $fieldset] = + '/plugins/' . strtolower($plugin->group + ) . '/' . strtolower($plugin->code_name) + . '/rules'; + } + + if (!isset($plugin->add_field_path[$file . $field_name . $fieldset])) + { + $plugin->add_field_path[$file . $field_name . $fieldset] = + '/plugins/' . strtolower($plugin->group + ) . '/' . strtolower($plugin->code_name) + . '/fields'; + } + } + // add path to plugin rules and custom fields + if (isset($plugin->add_rule_path[$file . $field_name . $fieldset]) + || isset($plugin->add_field_path[$file . $field_name . $fieldset])) { $xml .= PHP_EOL . $this->_t(1) . ''; - $xml .= PHP_EOL . $this->_t(1) - . '
_t(2) - . 'addrulepath="/plugins/' - . strtolower($plugin->group) . '/' - . strtolower($plugin->code_name) - . '/rules"'; - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/plugins/' - . strtolower($plugin->group) . '/' - . strtolower($plugin->code_name) - . '/fields"'; + . $this->setLine(__LINE__) . ' default paths of ' + . $fieldset . ' fieldset points to the plugin -->'; + + $xml .= PHP_EOL . $this->_t(1) . '
add_rule_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addrulepath="' . $plugin->add_rule_path[$file . $field_name . $fieldset] . '"'; + } + + if (isset($plugin->add_field_path[$file . $field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addfieldpath="' . $plugin->add_field_path[$file . $field_name . $fieldset] . '"'; + } + $xml .= PHP_EOL . $this->_t(1) . '>'; } else { - $xml .= PHP_EOL . $this->_t(1) - . '
'; + $xml .= PHP_EOL . $this->_t(1) . '
'; } // check if we have an inner field set - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $field_name_inner )) { @@ -1375,7 +1429,7 @@ class Structure extends Get $xml .= $this->hhh . 'FIELDSET_' . $file . $field_name . $fieldset . $this->hhh; // check if we have an inner field set - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $field_name_inner )) { @@ -1434,7 +1488,7 @@ class Structure extends Get ); // check if this lib has files if (isset($plugin->files) - && ComponentbuilderHelper::checkArray($plugin->files)) + && ArrayHelper::check($plugin->files)) { // add to component files foreach ($plugin->files as $file) @@ -1447,7 +1501,7 @@ class Structure extends Get } // check if this lib has folders if (isset($plugin->folders) - && ComponentbuilderHelper::checkArray($plugin->folders)) + && ArrayHelper::check($plugin->folders)) { // add to component folders foreach ($plugin->folders as $folder) @@ -1460,7 +1514,7 @@ class Structure extends Get } // check if this plugin has urls if (isset($plugin->urls) - && ComponentbuilderHelper::checkArray($plugin->urls)) + && ArrayHelper::check($plugin->urls)) { // add to component urls foreach ($plugin->urls as $n => &$url) @@ -1468,14 +1522,14 @@ class Structure extends Get // should we add the local folder if (isset($url['type']) && $url['type'] > 1 && isset($url['url']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $url['url'] )) { // set file name $fileName = basename($url['url']); // get the file contents - $data = ComponentbuilderHelper::getFileContents( + $data = FileHelper::getContent( $url['url'] ); // build sub path @@ -1543,7 +1597,7 @@ class Structure extends Get */ private function setLibraries() { - if (ComponentbuilderHelper::checkArray($this->libraries)) + if (ArrayHelper::check($this->libraries)) { // Trigger Event: jcb_ce_onBeforeSetLibraries $this->triggerEvent( @@ -1562,11 +1616,11 @@ class Structure extends Get $this->createFolder($this->componentPath . '/media'); foreach ($this->libraries as $id => &$library) { - if (ComponentbuilderHelper::checkObject($library)) + if (ObjectHelper::check($library)) { // check if this lib has files if (isset($library->files) - && ComponentbuilderHelper::checkArray($library->files)) + && ArrayHelper::check($library->files)) { // add to component files foreach ($library->files as $file) @@ -1576,7 +1630,7 @@ class Structure extends Get } // check if this lib has folders if (isset($library->folders) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $library->folders )) { @@ -1588,13 +1642,13 @@ class Structure extends Get } // check if this lib has urls if (isset($library->urls) - && ComponentbuilderHelper::checkArray($library->urls)) + && ArrayHelper::check($library->urls)) { // build media folder path $libFolder = strtolower( preg_replace( '/\s+/', '-', - ComponentbuilderHelper::safeString( + StringHelper::safe( $library->name, 'filename', ' ', false ) ) @@ -1607,7 +1661,7 @@ class Structure extends Get { if (isset($url['type']) && $url['type'] > 1 && isset($url['url']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $url['url'] )) { @@ -1620,7 +1674,7 @@ class Structure extends Get // set file name $fileName = basename($url['url']); // get the file contents - $data = ComponentbuilderHelper::getFileContents( + $data = FileHelper::getContent( $url['url'] ); // build sub path @@ -1664,7 +1718,7 @@ class Structure extends Get // if config fields are found load into component config (avoiding duplicates) if (isset($library->how) && $library->how > 1 && isset($library->config) - && ComponentbuilderHelper::checkArray($library->config)) + && ArrayHelper::check($library->config)) { foreach ($library->config as $cofig) { @@ -1675,7 +1729,7 @@ class Structure extends Get } ); // set the config data if not found - if (!ComponentbuilderHelper::checkArray($found)) + if (!ArrayHelper::check($found)) { $this->componentData->config[] = $cofig; } @@ -1698,7 +1752,7 @@ class Structure extends Get if (isset($this->componentData->dashboard_type) && 2 == $this->componentData->dashboard_type && isset($this->componentData->dashboard) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->componentData->dashboard ) && strpos($this->componentData->dashboard, '_') !== false) @@ -1708,7 +1762,7 @@ class Structure extends Get if (count((array) $getter) == 2 && is_numeric($getter[1])) { // the pointers - $t = ComponentbuilderHelper::safeString($getter[0], 'U'); + $t = StringHelper::safe($getter[0], 'U'); $id = (int) $getter[1]; // the dynamic stuff $targets = array('A' => 'admin_views', @@ -1721,12 +1775,12 @@ class Structure extends Get if (isset($targets[$t]) && $id > 0) { // set the type name - $type_names = ComponentbuilderHelper::safeString( + $type_names = StringHelper::safe( $targets[$t], 'w' ); // set the dynamic dash if (isset($this->componentData->{$targets[$t]}) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->{$targets[$t]} )) { @@ -1744,7 +1798,7 @@ class Structure extends Get } ); // set dashboard - if (ComponentbuilderHelper::checkArray($dashboard)) + if (ArrayHelper::check($dashboard)) { $dashboard = array_values($dashboard)[0]; } @@ -1753,7 +1807,7 @@ class Structure extends Get && isset($dashboard['settings']->{$keys[$t]})) { $this->dynamicDashboard - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $dashboard['settings']->{$keys[$t]} ); $this->dynamicDashboardType @@ -1818,7 +1872,7 @@ class Structure extends Get ); } // if default was changed to dynamic dashboard the remove default tab and methods - if (ComponentbuilderHelper::checkString($this->dynamicDashboard)) + if (StringHelper::check($this->dynamicDashboard)) { // dynamic dashboard is used $this->componentData->dashboard_tab = ''; @@ -1835,7 +1889,7 @@ class Structure extends Get */ public function writeFile($path, $data) { - return ComponentbuilderHelper::writeFile($path, $data); + return FileHelper::write($path, $data); } /** @@ -1846,7 +1900,7 @@ class Structure extends Get */ private function setFolders() { - if (ComponentbuilderHelper::checkObject( + if (ObjectHelper::check( $this->joomlaVersionData->create )) { @@ -1862,14 +1916,14 @@ class Structure extends Get foreach ($this->joomlaVersionData->create as $main => $folders) { $this->createFolder($this->componentPath . '/' . $main); - if (ComponentbuilderHelper::checkObject($folders)) + if (ObjectHelper::check($folders)) { foreach ($folders as $sub => $subFolders) { $this->createFolder( $this->componentPath . '/' . $main . '/' . $sub ); - if (ComponentbuilderHelper::checkObject($subFolders)) + if (ObjectHelper::check($subFolders)) { foreach ($subFolders as $sub_2 => $subFolders_2) { @@ -1877,7 +1931,7 @@ class Structure extends Get $this->componentPath . '/' . $main . '/' . $sub . '/' . $sub_2 ); - if (ComponentbuilderHelper::checkObject( + if (ObjectHelper::check( $subFolders_2 )) { @@ -1890,7 +1944,7 @@ class Structure extends Get . '/' . $sub . '/' . $sub_2 . '/' . $sub_3 ); - if (ComponentbuilderHelper::checkObject( + if (ObjectHelper::check( $subFolders_3 )) { @@ -1905,7 +1959,7 @@ class Structure extends Get . $sub_2 . '/' . $sub_3 . '/' . $sub_4 ); - if (ComponentbuilderHelper::checkObject( + if (ObjectHelper::check( $subFolders_4 )) { @@ -1923,7 +1977,7 @@ class Structure extends Get . $sub_4 . '/' . $sub_5 ); - if (ComponentbuilderHelper::checkObject( + if (ObjectHelper::check( $subFolders_5 )) { @@ -1950,7 +2004,7 @@ class Structure extends Get . '/' . $sub_6 ); - if (ComponentbuilderHelper::checkObject( + if (ObjectHelper::check( $subFolders_6 )) { @@ -2011,7 +2065,7 @@ class Structure extends Get */ private function setStatic() { - if (ComponentbuilderHelper::checkObject( + if (ObjectHelper::check( $this->joomlaVersionData->move->static )) { @@ -2200,7 +2254,7 @@ class Structure extends Get // TODO <-- this may not be the best way, will keep an eye on this. // We basicly only want to check if a folder is added that is not in the stdFolders array if (isset($checker[0]) - && ComponentbuilderHelper::checkString($checker[0]) + && StringHelper::check($checker[0]) && !in_array($checker[0], $this->stdFolders)) { // check if we should add the dynamic folder moving script to the installer script @@ -2222,7 +2276,7 @@ class Structure extends Get } } elseif (count((array) $checker) == 2 - && ComponentbuilderHelper::checkString($checker[0])) + && StringHelper::check($checker[0])) { $add_to_extra = false; // set the target @@ -2254,7 +2308,7 @@ class Structure extends Get } // set the xml file $this->fileContentStatic[$this->hhh . 'EXSTRA_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $checker[0], 'U' ) . '_' . $eNAME . $this->hhh] .= PHP_EOL . $eTab . "<" . $ename . ">" @@ -2281,15 +2335,15 @@ class Structure extends Get $back = false; $front = false; if ((isset($this->joomlaVersionData->move->dynamic) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $this->joomlaVersionData->move->dynamic )) && (isset($this->componentData->admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->admin_views ))) { - if (!ComponentbuilderHelper::checkString($this->dynamicDashboard)) + if (!StringHelper::check($this->dynamicDashboard)) { // setup dashboard $target = array('admin' => $this->componentData->name_code); @@ -2298,7 +2352,7 @@ class Structure extends Get // now the rest of the views foreach ($this->componentData->admin_views as $nr => $view) { - if (ComponentbuilderHelper::checkObject($view['settings'])) + if (ObjectHelper::check($view['settings'])) { $created = $this->getCreatedDate($view); $modified = $this->getLastModifiedDate($view); @@ -2357,11 +2411,11 @@ class Structure extends Get $back = true; } if ((isset($this->joomlaVersionData->move->dynamic) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $this->joomlaVersionData->move->dynamic )) && (isset($this->componentData->site_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->site_views ))) { @@ -2398,11 +2452,11 @@ class Structure extends Get $front = true; } if ((isset($this->joomlaVersionData->move->dynamic) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $this->joomlaVersionData->move->dynamic )) && (isset($this->componentData->custom_admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->custom_admin_views ))) { @@ -2539,12 +2593,12 @@ class Structure extends Get 'trim', explode( ',', - ComponentbuilderHelper::getBetween( + GetHelper::between( $multi_field['settings']->xml, 'fields="', '"' ) ) ); - if (ComponentbuilderHelper::checkArray($ids)) + if (ArrayHelper::check($ids)) { foreach ($ids as $id) { @@ -2569,7 +2623,7 @@ class Structure extends Get public function getCreatedDate($view) { if (isset($view['settings']->created) - && ComponentbuilderHelper::checkString($view['settings']->created)) + && StringHelper::check($view['settings']->created)) { // first set the main date $date = strtotime($view['settings']->created); @@ -2595,7 +2649,7 @@ class Structure extends Get { // first set the main date if (isset($view['settings']->modified) - && ComponentbuilderHelper::checkString($view['settings']->modified) + && StringHelper::check($view['settings']->modified) && '0000-00-00 00:00:00' !== $view['settings']->modified) { $date = strtotime($view['settings']->modified); @@ -2613,18 +2667,18 @@ class Structure extends Get if (!isset($this->lastModifiedDate[$id])) { if (isset($view['settings']->fields) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->fields )) { foreach ($view['settings']->fields as $field) { if (isset($field['settings']) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $field['settings'] ) && isset($field['settings']->modified) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $field['settings']->modified ) && '0000-00-00 00:00:00' @@ -2649,7 +2703,7 @@ class Structure extends Get if (!isset($this->lastModifiedDate[$id])) { if (isset($view['settings']->main_get->modified) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view['settings']->main_get->modified ) && '0000-00-00 00:00:00' @@ -2672,7 +2726,7 @@ class Structure extends Get if (!isset($this->lastModifiedDate[$id])) { if (isset($view['settings']->main_get->modified) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view['settings']->main_get->modified ) && '0000-00-00 00:00:00' @@ -2722,13 +2776,13 @@ class Structure extends Get // did we build the files (any number) $build_status = false; // check that we have the target values - if (ComponentbuilderHelper::checkArray($target)) + if (ArrayHelper::check($target)) { // search the target foreach ($target as $main => $name) { // make sure it is lower case - $name = ComponentbuilderHelper::safeString($name); + $name = StringHelper::safe($name); // setup the files foreach ( $this->joomlaVersionData->move->dynamic->{$main} as $item => @@ -2813,7 +2867,7 @@ class Structure extends Get $newFIle = array('path' => $path . '/' . $new, 'name' => $new, 'view' => $name, 'zip' => $zipPath . '/' . $new); - if (ComponentbuilderHelper::checkArray($config)) + if (ArrayHelper::check($config)) { $newFIle['config'] = $config; } @@ -2837,15 +2891,28 @@ class Structure extends Get */ private function setJoomlaVersionData() { + // option to load other settings + $custom_settings = $this->templatePath . '/settings_' . $this->componentCodeName . '.json'; // set the version data - $versionData = json_decode( - ComponentbuilderHelper::getFileContents( - $this->templatePath . '/settings.json' - ) - ); + if (File::exists($custom_settings)) + { + $version_data = json_decode( + FileHelper::getContent( + $custom_settings + ) + ); + } + else + { + $version_data = json_decode( + FileHelper::getContent( + $this->templatePath . '/settings.json' + ) + ); + } // add custom folders if ((isset($this->componentData->folders) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->folders )) || $this->addEximport @@ -2917,7 +2984,7 @@ class Structure extends Get ); // fix custom path if (isset($custom['path']) - && ComponentbuilderHelper::checkString($custom['path'])) + && StringHelper::check($custom['path'])) { $custom['path'] = trim($custom['path'], '/'); } @@ -2969,31 +3036,31 @@ class Structure extends Get $newname = ''; } // insure we have no duplicates - $key_pointer = ComponentbuilderHelper::safeString( + $key_pointer = StringHelper::safe( $custom['folder'] ) . '_f' . $pointer_tracker; $pointer_tracker++; // fix custom path $custom['path'] = ltrim($custom['path'], '/'); // set new folder to object - $versionData->move->static->{$key_pointer} = new stdClass(); - $versionData->move->static->{$key_pointer}->naam + $version_data->move->static->{$key_pointer} = new stdClass(); + $version_data->move->static->{$key_pointer}->naam = str_replace( '//', '/', $custom['folder'] ); - $versionData->move->static->{$key_pointer}->path + $version_data->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path']; - $versionData->move->static->{$key_pointer}->rename = $rename; - $versionData->move->static->{$key_pointer}->newName = $newname; - $versionData->move->static->{$key_pointer}->type = 'folder'; - $versionData->move->static->{$key_pointer}->custom + $version_data->move->static->{$key_pointer}->rename = $rename; + $version_data->move->static->{$key_pointer}->newName = $newname; + $version_data->move->static->{$key_pointer}->type = 'folder'; + $version_data->move->static->{$key_pointer}->custom = $customPath; // set the target if type and id is found if (isset($custom['target_id']) && isset($custom['target_type'])) { - $versionData->move->static->{$key_pointer}->_target + $version_data->move->static->{$key_pointer}->_target = array('key' => $custom['target_id'] . '_' . $custom['target_type'], 'type' => $custom['target_type']); @@ -3004,7 +3071,7 @@ class Structure extends Get } // add custom files if ((isset($this->componentData->files) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->files )) || $this->googlechart) @@ -3058,13 +3125,13 @@ class Structure extends Get $customPath = 'full'; } // make sure we have not duplicates - $key_pointer = ComponentbuilderHelper::safeString( + $key_pointer = StringHelper::safe( $custom['file'] ) . '_g' . $pointer_tracker; $pointer_tracker++; // set new file to object - $versionData->move->static->{$key_pointer} = new stdClass(); - $versionData->move->static->{$key_pointer}->naam = str_replace( + $version_data->move->static->{$key_pointer} = new stdClass(); + $version_data->move->static->{$key_pointer}->naam = str_replace( '//', '/', $custom['file'] ); // update the dynamic component name placholders in file names @@ -3077,11 +3144,11 @@ class Structure extends Get { $pathInfo['dirname'] = trim($pathInfo['dirname'], '/'); // set the info - $versionData->move->static->{$key_pointer}->path + $version_data->move->static->{$key_pointer}->path = $_target_type . '/' . $pathInfo['dirname']; - $versionData->move->static->{$key_pointer}->rename = 'new'; - $versionData->move->static->{$key_pointer}->newName + $version_data->move->static->{$key_pointer}->rename = 'new'; + $version_data->move->static->{$key_pointer}->newName = $pathInfo['basename']; } elseif ('full' === $customPath) @@ -3091,11 +3158,11 @@ class Structure extends Get // get file array $fileArray = (array) explode('/', $custom['file']); // set the info - $versionData->move->static->{$key_pointer}->path + $version_data->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path']; - $versionData->move->static->{$key_pointer}->rename = 'new'; - $versionData->move->static->{$key_pointer}->newName = end( + $version_data->move->static->{$key_pointer}->rename = 'new'; + $version_data->move->static->{$key_pointer}->newName = end( $fileArray ); } @@ -3104,19 +3171,19 @@ class Structure extends Get // fix custom path $custom['path'] = ltrim($custom['path'], '/'); // set the info - $versionData->move->static->{$key_pointer}->path + $version_data->move->static->{$key_pointer}->path = $_target_type . '/' . $custom['path']; - $versionData->move->static->{$key_pointer}->rename = false; + $version_data->move->static->{$key_pointer}->rename = false; } - $versionData->move->static->{$key_pointer}->type = 'file'; - $versionData->move->static->{$key_pointer}->custom + $version_data->move->static->{$key_pointer}->type = 'file'; + $version_data->move->static->{$key_pointer}->custom = $customPath; // set the target if type and id is found if (isset($custom['target_id']) && isset($custom['target_type'])) { - $versionData->move->static->{$key_pointer}->_target + $version_data->move->static->{$key_pointer}->_target = array('key' => $custom['target_id'] . '_' . $custom['target_type'], 'type' => $custom['target_type']); @@ -3137,7 +3204,7 @@ class Structure extends Get unset($custom); } - return $versionData; + return $version_data; } /** diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 2b9b19c40..3a4787e77 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -13,6 +13,12 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\String\FieldHelper; + /** * Compiler class */ @@ -396,7 +402,7 @@ class Fields extends Structure ) { // setup the fieldset of this view if (isset($view['settings']->fields) - && ComponentbuilderHelper::checkArray($view['settings']->fields)) + && ArrayHelper::check($view['settings']->fields)) { // add metadata to the view if (isset($view['metadata']) && $view['metadata']) @@ -764,7 +770,7 @@ class Fields extends Structure } // check if view has access if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] ) && !isset($this->fieldsNames[$nameSingleCode]['access'])) @@ -830,7 +836,7 @@ class Fields extends Structure } // check if metadata is added to this view if (isset($this->metadataBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->metadataBuilder[$nameSingleCode] )) { @@ -907,7 +913,7 @@ class Fields extends Structure ); } // load the dynamic fields now - if (ComponentbuilderHelper::checkString($dynamicFields)) + if (StringHelper::check($dynamicFields)) { $fieldSet[] = $this->_t(2) . "" . $dynamicFields; @@ -916,7 +922,7 @@ class Fields extends Structure $fieldSet[] = $this->_t(1) . "
"; // check if metadata is added to this view if (isset($this->metadataBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->metadataBuilder[$nameSingleCode] )) { @@ -1192,7 +1198,7 @@ class Fields extends Structure } // check if view has access if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] ) && !isset($this->fieldsNames[$nameSingleCode]['access'])) @@ -1262,7 +1268,7 @@ class Fields extends Structure } // check if metadata is added to this view if (isset($this->metadataBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->metadataBuilder[$nameSingleCode] )) { @@ -1362,7 +1368,7 @@ class Fields extends Structure } // check if metadata is added to this view if (isset($this->metadataBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->metadataBuilder[$nameSingleCode] )) { @@ -1496,7 +1502,7 @@ class Fields extends Structure } // check if the view has permissions if (isset($view['settings']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->permissions, true )) { @@ -1521,7 +1527,7 @@ class Fields extends Structure } // check if the fields has permissions if (isset($view['settings']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->fields, true )) { @@ -1530,7 +1536,7 @@ class Fields extends Structure // if a field has any permissions // the a view has permissions if (isset($field['permission']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $field['permission'], true )) { @@ -1592,7 +1598,7 @@ class Fields extends Structure } // make sure we have settings if (isset($field['settings']) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $field['settings'] )) { @@ -1609,7 +1615,7 @@ class Fields extends Structure $langView, $nameListCode, $nameSingleCode, $placeholders ); // check if values were set - if (ComponentbuilderHelper::checkArray($fieldAttributes)) + if (ArrayHelper::check($fieldAttributes)) { // set the array of field names $this->setFieldsNames( @@ -1689,7 +1695,7 @@ class Fields extends Structure } } elseif (isset($fieldAttributes['custom']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $fieldAttributes['custom'] )) { @@ -1772,7 +1778,7 @@ class Fields extends Structure $fieldset = array(); } // loop over the fields to build - if (ComponentbuilderHelper::checkArray($fields)) + if (ArrayHelper::check($fields)) { foreach ($fields as $field) { @@ -1784,7 +1790,7 @@ class Fields extends Structure ); // make sure the xml is set and a string if (isset($xmlField) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $xmlField )) { @@ -1933,7 +1939,7 @@ class Fields extends Structure // now add to the field set $field .= PHP_EOL . $this->_t(1) . $taber . $this->_t(1) . ""; $field .= PHP_EOL . $this->_t(1) . $taber . $this->_t(1) @@ -1971,7 +1977,7 @@ class Fields extends Structure if (count((array) $valueKeyArray) == 2) { $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $valueKeyArray[0], true ); // add to lang array @@ -1995,7 +2001,7 @@ class Fields extends Structure if (count((array) $valueKeyArray) == 3) { $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $valueKeyArray[1], true ); // add to lang array @@ -2019,7 +2025,7 @@ class Fields extends Structure else { $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $valueKeyArray[1], true ); // add to lang array @@ -2045,7 +2051,7 @@ class Fields extends Structure { // text is also the value $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $option, true ); // add to lang array @@ -2076,7 +2082,7 @@ class Fields extends Structure // check if this is a group loader if ('group' === $key_ && isset($groups_[$_id]) && isset($grouped_[$key_][$_id]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $grouped_[$key_][$_id] )) { @@ -2093,7 +2099,7 @@ class Fields extends Structure . $this->_t(2) . ''; } elseif (isset($grouped_[$key_][$_id]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $grouped_[$key_][$_id] )) { @@ -2112,7 +2118,7 @@ class Fields extends Structure // has other value then text list($v, $t) = explode('|', $option); $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $t, true ); // add to lang array @@ -2131,7 +2137,7 @@ class Fields extends Structure { // text is also the value $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $option, true ); // add to lang array @@ -2156,7 +2162,7 @@ class Fields extends Structure // has other value then text list($v, $t) = explode('|', $value); $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $t, true ); // add to lang array @@ -2172,7 +2178,7 @@ class Fields extends Structure { // text is also the value $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $value, true ); // add to lang array @@ -2191,7 +2197,7 @@ class Fields extends Structure } } // if options were found - if (ComponentbuilderHelper::checkString($optionSet)) + if (StringHelper::check($optionSet)) { $field .= '>'; $field .= PHP_EOL . $this->_t(3) . $taber . ""; $field .= PHP_EOL . $this->_t(2) . $taber . " $value) @@ -2239,7 +2245,7 @@ class Fields extends Structure // now add to the field set $field .= PHP_EOL . $this->_t(2) . ""; $field .= PHP_EOL . $this->_t(2) . " $value) @@ -2260,7 +2266,7 @@ class Fields extends Structure $field .= PHP_EOL . $this->_t(2) . ""; $field .= PHP_EOL . $this->_t(2) . "setLangContent( $this->lang, $r_listLangName, - ComponentbuilderHelper::safeString( + StringHelper::safe( $r_name, 'W' ) ); // if label was set use instead - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $r_langLabel )) { @@ -2427,7 +2433,7 @@ class Fields extends Structure // now add to the field set $field .= PHP_EOL . $this->_t(2) . $taber . ""; $field .= PHP_EOL . $this->_t(2) . $taber . "setLangContent( $this->lang, $r_listLangName, - ComponentbuilderHelper::safeString( + StringHelper::safe( $r_name, 'W' ) ); // if label was set use instead - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $r_langLabel )) { @@ -2619,7 +2625,7 @@ class Fields extends Structure . $this->setLine( __LINE__ ) . " " . ucfirst($name) . " Field. Type: " - . ComponentbuilderHelper::safeString($typeName, 'F') + . StringHelper::safe($typeName, 'F') . ". (custom) -->"; $field .= PHP_EOL . $this->_t(2) . $taber . "_t(2) . ''; } elseif (isset($grouped_[$key_][$_id]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $grouped_[$key_][$_id] )) { @@ -2796,7 +2802,7 @@ class Fields extends Structure // has other value then text list($v, $t) = explode('|', $option); $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $t, true ); // add to lang array @@ -2815,7 +2821,7 @@ class Fields extends Structure { // text is also the value $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $option, true ); // add to lang array @@ -2840,7 +2846,7 @@ class Fields extends Structure // has other value then text list($v, $t) = explode('|', $value); $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $t, true ); // add to lang array @@ -2856,7 +2862,7 @@ class Fields extends Structure { // text is also the value $langValue = $langView . '_' - . ComponentbuilderHelper::safeFieldName( + . FieldHelper::safe( $value, true ); // add to lang array @@ -2875,7 +2881,7 @@ class Fields extends Structure } } // if options were found - if (ComponentbuilderHelper::checkString($optionSet)) + if (StringHelper::check($optionSet)) { $field .= '>'; $field .= PHP_EOL . $this->_t(3) . $taber . "') !== false && strpos($field, $menuSetter) === false - && !ComponentbuilderHelper::checkString($target)) + && !StringHelper::check($target)) { // we add the global option $field = str_replace( @@ -2434,7 +2440,7 @@ class Interpretation extends Fields ) { $query = ''; - if (ComponentbuilderHelper::checkArray($gets)) + if (ArrayHelper::check($gets)) { $mainAsArray = array(); $check = 'zzz'; @@ -2449,7 +2455,7 @@ class Interpretation extends Fields $this->customViewQueryChecker[$this->target][$checker] = true; if (isset($the_get['selection']['type']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $the_get['selection']['type'] )) { @@ -2475,16 +2481,16 @@ class Interpretation extends Fields // load the from selection if (($nr == 0 && (!isset($the_get['join_field']) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $the_get['join_field'] )) && (isset($the_get['selection']['type']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $the_get['selection']['type'] ))) || ($type === 'custom' && (isset($the_get['selection']['type']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $the_get['selection']['type'] )))) { @@ -2493,11 +2499,11 @@ class Interpretation extends Fields . ');'; } elseif (isset($the_get['join_field']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $the_get['join_field'] ) && isset($the_get['selection']['type']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $the_get['selection']['type'] )) { @@ -2519,7 +2525,7 @@ class Interpretation extends Fields )) !== false) { if (isset($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']] ) && !in_array($check, $mainAsArray)) @@ -2552,7 +2558,7 @@ class Interpretation extends Fields { $filter = ''; // check if filter is set for this field - if (ComponentbuilderHelper::checkArray($filters)) + if (ArrayHelper::check($filters)) { foreach ($filters as $field => $ter) { @@ -2794,7 +2800,7 @@ class Interpretation extends Fields // check if we should load this again if (strpos($get['selection']['select'], $field) !== false && !isset($this->loadTracker[$key]) - && ComponentbuilderHelper::checkArray($array['decode'])) + && ArrayHelper::check($array['decode'])) { // set the key $this->loadTracker[$key] = $key; @@ -2880,7 +2886,7 @@ class Interpretation extends Fields } } // check if we have found the details - if (ComponentbuilderHelper::checkString($if)) + if (StringHelper::check($if)) { // build decoder string $fieldDecode .= PHP_EOL . $this->_t(1) . $tab @@ -2890,7 +2896,7 @@ class Interpretation extends Fields . "//" . $this->setLine(__LINE__) . " Decode " . $field; } - if (ComponentbuilderHelper::checkString($decoder)) + if (StringHelper::check($decoder)) { // build decoder string $fieldDecode .= PHP_EOL . $this->_t(1) . $tab @@ -3028,7 +3034,7 @@ class Interpretation extends Fields $tab = '' ) { - if (ComponentbuilderHelper::checkArray($gets)) + if (ArrayHelper::check($gets)) { $customJoin = ''; foreach ($gets as $get) @@ -3089,7 +3095,7 @@ class Interpretation extends Fields { // check if this function is not linked to the main call list($aJoin) = explode('.', $get['on_field']); - if (ComponentbuilderHelper::checkArray($asBucket) + if (ArrayHelper::check($asBucket) && in_array( $aJoin, $asBucket )) @@ -3098,7 +3104,7 @@ class Interpretation extends Fields } // default fallback elseif (isset($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']] )) { @@ -3111,7 +3117,7 @@ class Interpretation extends Fields public function setCustomViewFilter(&$filter, &$code, $tab = '') { $filters = ''; - if (ComponentbuilderHelper::checkArray($filter)) + if (ArrayHelper::check($filter)) { foreach ($filter as $ter) { @@ -3149,7 +3155,7 @@ class Interpretation extends Fields // COM_COMPONENTBUILDER_DYNAMIC_GET_USER_GROUPS $decodeChecker = $this->siteFieldData['decode'][$code][$ter['key']][$as][$field]; - if (ComponentbuilderHelper::checkArray($decodeChecker) + if (ArrayHelper::check($decodeChecker) || $ter['state_key'] === 'array') { // set needed fields to filter after query @@ -3286,12 +3292,12 @@ class Interpretation extends Fields break; } // only add if the filter is set - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { // sort where if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->siteMainGet[$this->target][$code][$as] ))) { @@ -3312,7 +3318,7 @@ class Interpretation extends Fields public function setCustomViewGroup(&$group, &$code, $tab = '') { $grouping = ''; - if (ComponentbuilderHelper::checkArray($group)) + if (ArrayHelper::check($group)) { foreach ($group as $gr) { @@ -3324,7 +3330,7 @@ class Interpretation extends Fields // sort where if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->siteMainGet[$this->target][$code][$as] ))) { @@ -3345,7 +3351,7 @@ class Interpretation extends Fields public function setCustomViewOrder(&$order, &$code, $tab = '') { $ordering = ''; - if (ComponentbuilderHelper::checkArray($order)) + if (ArrayHelper::check($order)) { foreach ($order as $or) { @@ -3367,7 +3373,7 @@ class Interpretation extends Fields // sort where if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->siteMainGet[$this->target][$code][$as] ))) { @@ -3388,7 +3394,7 @@ class Interpretation extends Fields public function setCustomViewWhere(&$where, &$code, $tab = '') { $wheres = ''; - if (ComponentbuilderHelper::checkArray($where)) + if (ArrayHelper::check($where)) { foreach ($where as $whe) { @@ -3428,12 +3434,12 @@ class Interpretation extends Fields $value = " " . $whe['value_key'] . "');"; } } - elseif (ComponentbuilderHelper::checkString($whe['value_key'])) + elseif (StringHelper::check($whe['value_key'])) { $value = " " . $whe['value_key'] . "');"; } // only load if there is a value - if (ComponentbuilderHelper::checkString($value)) + if (StringHelper::check($value)) { $tabe = ''; if ($as === 'a') @@ -3479,7 +3485,7 @@ class Interpretation extends Fields // sort where if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->siteMainGet[$this->target][$code][$as] ))) { @@ -3501,7 +3507,7 @@ class Interpretation extends Fields public function setCustomViewGlobals(&$global, $string, $as, $tab = '') { $globals = ''; - if (ComponentbuilderHelper::checkArray($global)) + if (ArrayHelper::check($global)) { $as = array_unique($as); foreach ($global as $glo) @@ -3524,7 +3530,7 @@ class Interpretation extends Fields break; } // only add if the filter is set - if (ComponentbuilderHelper::checkString($value)) + if (StringHelper::check($value)) { $globals .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) @@ -3611,7 +3617,7 @@ class Interpretation extends Fields . "\$app = JFactory::getApplication();"; // set lang $langKeyWord = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( 'Not authorised to view ' . $view['settings']->code . '!', 'U' ); @@ -3646,7 +3652,7 @@ class Interpretation extends Fields $type = 'main' ) { - if (ComponentbuilderHelper::checkObject($get)) + if (ObjectHelper::check($get)) { // set the site decription switches foreach ($this->cryptionTypes as $cryptionType) @@ -3659,7 +3665,7 @@ class Interpretation extends Fields if (isset($get->add_php_before_getitem) && $get->add_php_before_getitem == 1 && isset($get->php_before_getitem) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $get->php_before_getitem )) { @@ -3700,27 +3706,48 @@ class Interpretation extends Fields { $getItem .= $this->setCustomViewGroup($get->group, $code, $tab); } - // get ready to get query - $getItem .= PHP_EOL . PHP_EOL . $tab . $this->_t(2) . "//" - . $this->setLine(__LINE__) - . " Reset the query using our newly populated query object."; - $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) - . "\$db->setQuery(\$query);"; - $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" - . $this->setLine(__LINE__) - . " Load the results as a stdClass object."; - $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) - . "\$data = \$db->loadObject();"; + // db set query data placeholder + $getItem .= $this->hhh . "DB_SET_QUERY_DATA" . $this->hhh; // set after item php if (isset($get->add_php_after_getitem) && $get->add_php_after_getitem == 1 && isset($get->php_after_getitem) - && ComponentbuilderHelper::checkString($get->php_after_getitem)) + && StringHelper::check($get->php_after_getitem)) { $getItem .= $this->setPlaceholders( $get->php_after_getitem, $this->placeholders ); } + // check the getItem string to see if we should still add set query to data + if (strpos($getItem, '$data =') === false) + { + // get ready to get query + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] = + PHP_EOL . PHP_EOL . $tab . $this->_t(2) . "//" + . $this->setLine(__LINE__) + . " Reset the query using our newly populated query object."; + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] .= + PHP_EOL . $this->_t(1) . $tab . $this->_t(1) + . "\$db->setQuery(\$query);"; + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] .= + PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" + . $this->setLine(__LINE__) + . " Load the results as a stdClass object."; + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] .= + PHP_EOL . $this->_t(1) . $tab . $this->_t(1) + . "\$data = \$db->loadObject();"; + // add the db set query to data + } + else + { + // remove our placeholder + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] = ''; + } + // add the db set query to data + $getItem = str_replace( + array_keys($setQuery), + array_values($setQuery), $getItem + ); $getItem .= PHP_EOL . PHP_EOL . $tab . $this->_t(2) . "if (empty(\$data))"; $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{"; @@ -3729,7 +3756,7 @@ class Interpretation extends Fields $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "\$app = JFactory::getApplication();"; $langKeyWoord = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( 'Not found or access denied', 'U' ); $this->setLangContent( @@ -3778,9 +3805,9 @@ class Interpretation extends Fields . "return false;"; } $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "}"; - // dispatcher placholder + // dispatcher placeholder $getItem .= $this->hhh . "DISPATCHER" . $this->hhh; - if (ComponentbuilderHelper::checkArray($get->main_get)) + if (ArrayHelper::check($get->main_get)) { $asBucket = array(); foreach ($get->main_get as $main_get) @@ -3791,7 +3818,7 @@ class Interpretation extends Fields { $decodeChecker = $this->siteFieldData['decode'][$code][$main_get['key']][$main_get['as']]; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $decodeChecker )) { @@ -3807,7 +3834,7 @@ class Interpretation extends Fields { $decodeFilter = $this->siteFieldDecodeFilter[$this->target][$code][$main_get['key']][$main_get['as']]; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $decodeFilter )) { @@ -3823,7 +3850,7 @@ class Interpretation extends Fields { $contentprepareChecker = $this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']]; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $contentprepareChecker )) { @@ -3839,7 +3866,7 @@ class Interpretation extends Fields { $uikitChecker = $this->siteFieldData['uikit'][$code][$main_get['key']][$main_get['as']]; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $uikitChecker )) { @@ -3948,7 +3975,7 @@ class Interpretation extends Fields { // check if the dispather should be added if (!isset($this->JEventDispatcher) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->JEventDispatcher )) { @@ -3972,21 +3999,21 @@ class Interpretation extends Fields { $methods = ''; // then set the needed custom methods - if (ComponentbuilderHelper::checkArray($main_view) + if (ArrayHelper::check($main_view) && isset($main_view['settings']) - && ComponentbuilderHelper::checkObject($main_view['settings']) + && ObjectHelper::check($main_view['settings']) && isset($main_view['settings']->custom_get)) { $_dynamic_get = $main_view['settings']->custom_get; } - elseif (ComponentbuilderHelper::checkObject($main_view) + elseif (ObjectHelper::check($main_view) && isset($main_view->custom_get)) { $_dynamic_get = $main_view->custom_get; } // check if we have an array if (isset($_dynamic_get) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $_dynamic_get )) { @@ -3994,11 +4021,11 @@ class Interpretation extends Fields foreach ($_dynamic_get as $view) { // fix alias to use in code - $view->code = ComponentbuilderHelper::safeString($code); - $view->Code = ComponentbuilderHelper::safeString( + $view->code = StringHelper::safe($code); + $view->Code = StringHelper::safe( $view->code, 'F' ); - $view->CODE = ComponentbuilderHelper::safeString( + $view->CODE = StringHelper::safe( $view->code, 'U' ); $main = ''; @@ -4056,7 +4083,7 @@ class Interpretation extends Fields if (isset($view->add_php_getlistquery) && $view->add_php_getlistquery == 1 && isset($view->php_getlistquery) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view->php_getlistquery )) { @@ -4072,7 +4099,7 @@ class Interpretation extends Fields if (isset($view->add_php_before_getitems) && $view->add_php_before_getitems == 1 && isset($view->php_before_getitems) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view->php_before_getitems )) { @@ -4092,7 +4119,7 @@ class Interpretation extends Fields if (isset($view->add_php_after_getitems) && $view->add_php_after_getitems == 1 && isset($view->php_after_getitems) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view->php_after_getitems )) { @@ -4125,7 +4152,7 @@ class Interpretation extends Fields } } // load uikit get method - if (ComponentbuilderHelper::checkArray($main_view) + if (ArrayHelper::check($main_view) && isset($main_view['settings'])) { $methods .= $this->setUikitGetMethod(); @@ -4293,7 +4320,7 @@ class Interpretation extends Fields public function setMainCustomMehtod(&$body, $nAme, $type) { $method = ''; - if (ComponentbuilderHelper::checkString($body)) + if (StringHelper::check($body)) { // build custom method $method .= PHP_EOL . PHP_EOL . $this->_t(1) . "/**"; @@ -4316,10 +4343,10 @@ class Interpretation extends Fields $methods = ''; $this->JEventDispatcher = ''; // first set the needed item/s methods - if (ComponentbuilderHelper::checkObject($main_get)) + if (ObjectHelper::check($main_get)) { if (isset($main_get->custom_get) - && ComponentbuilderHelper::checkArray($main_get->custom_get)) + && ArrayHelper::check($main_get->custom_get)) { foreach ($main_get->custom_get as $get) { @@ -4411,12 +4438,12 @@ class Interpretation extends Fields // check if other queries should be loaded $queryChecker = (isset($this->otherQuery[$this->target][$default['code']][$default['as']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->otherQuery[$this->target][$default['code']][$default['as']] )) ? $this->otherQuery[$this->target][$default['code']][$default['as']] : ''; - if (ComponentbuilderHelper::checkArray($queryChecker)) + if (ArrayHelper::check($queryChecker)) { foreach ($queryChecker as $query) { @@ -4425,7 +4452,7 @@ class Interpretation extends Fields } // add any other filter that was set if (isset($this->otherFilter[$this->target][$default['code']][$default['as']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->otherFilter[$this->target][$default['code']][$default['as']] )) { @@ -4439,7 +4466,7 @@ class Interpretation extends Fields } // add any other where that was set if (isset($this->otherWhere[$this->target][$default['code']][$default['as']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->otherWhere[$this->target][$default['code']][$default['as']] )) { @@ -4453,7 +4480,7 @@ class Interpretation extends Fields } // add any other order that was set if (isset($this->otherOrder[$this->target][$default['code']][$default['as']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->otherOrder[$this->target][$default['code']][$default['as']] )) { @@ -4467,7 +4494,7 @@ class Interpretation extends Fields } // add any other grouping that was set if (isset($this->otherGroup[$this->target][$default['code']][$default['as']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->otherGroup[$this->target][$default['code']][$default['as']] )) { @@ -4524,34 +4551,34 @@ class Interpretation extends Fields . $this->hhh => '$item'); $joinedChecker = (isset($this->otherJoin[$this->target][$default['code']][$default['as']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->otherJoin[$this->target][$default['code']][$default['as']] )) ? $this->otherJoin[$this->target][$default['code']][$default['as']] : ''; if ((isset($decodeChecker) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $decodeChecker )) || (isset($uikitChecker) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $uikitChecker )) || (isset($decodeFilter) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $decodeFilter )) || (isset($contentprepareChecker) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $contentprepareChecker )) - || ComponentbuilderHelper::checkArray( + || ArrayHelper::check( $joinedChecker )) { $decoder = ''; if (isset($decodeChecker) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $decodeChecker )) { @@ -4563,7 +4590,7 @@ class Interpretation extends Fields } $decoder_filter = ''; if (isset($decodeFilter) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $decodeFilter )) { @@ -4575,7 +4602,7 @@ class Interpretation extends Fields } $contentprepare = ''; if (isset($contentprepareChecker) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $contentprepareChecker )) { @@ -4587,7 +4614,7 @@ class Interpretation extends Fields } $uikit = ''; if (isset($uikitChecker) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $uikitChecker )) { @@ -4597,7 +4624,7 @@ class Interpretation extends Fields ); } $joine = ''; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $joinedChecker )) { @@ -4608,15 +4635,15 @@ class Interpretation extends Fields ); } } - if (ComponentbuilderHelper::checkString($decoder) - || ComponentbuilderHelper::checkString( + if (StringHelper::check($decoder) + || StringHelper::check( $contentprepare ) - || ComponentbuilderHelper::checkString($uikit) - || ComponentbuilderHelper::checkString( + || StringHelper::check($uikit) + || StringHelper::check( $decoder_filter ) - || ComponentbuilderHelper::checkString($joine)) + || StringHelper::check($joine)) { $methods .= PHP_EOL . $this->_t(3) . "\$items = \$db->loadObjectList();"; @@ -4626,29 +4653,29 @@ class Interpretation extends Fields $methods .= PHP_EOL . $this->_t(3) . "foreach (\$items as \$nr => &\$item)"; $methods .= PHP_EOL . $this->_t(3) . "{"; - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $decoder )) { $methods .= $decoder; } - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $decoder_filter )) { $methods .= $decoder_filter; } - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $contentprepare )) { $methods .= $contentprepare; } - if (ComponentbuilderHelper::checkString($uikit)) + if (StringHelper::check($uikit)) { $methods .= $uikit; } - if (ComponentbuilderHelper::checkString($joine)) + if (StringHelper::check($joine)) { $methods .= $joine; } @@ -4726,7 +4753,7 @@ class Interpretation extends Fields } } // insure the crypt placeholder is removed - if (ComponentbuilderHelper::checkString($methods)) + if (StringHelper::check($methods)) { $methods = str_replace( $this->hhh . 'CRYPT' . $this->hhh, '', $methods @@ -4739,7 +4766,7 @@ class Interpretation extends Fields { // check if the dispather should be added if (!isset($this->JEventDispatcher) - || !ComponentbuilderHelper::checkArray($this->JEventDispatcher)) + || !ArrayHelper::check($this->JEventDispatcher)) { $this->JEventDispatcher = array($this->hhh . 'DISPATCHER' . $this->hhh => ''); @@ -4750,7 +4777,7 @@ class Interpretation extends Fields ); } // insure the crypt placeholder is removed - if (ComponentbuilderHelper::checkString($methods)) + if (StringHelper::check($methods)) { return $methods . PHP_EOL; } @@ -4763,32 +4790,32 @@ class Interpretation extends Fields if (isset($get['key']) && isset($get['as'])) { $key = substr( - ComponentbuilderHelper::safeString( + StringHelper::safe( preg_replace('/[0-9]+/', '', md5($get['key'])), 'F' ), 0, 4 ); $method['on_field'] = (isset($get['on_field'])) ? $this->removeAsDot($get['on_field']) : null; $method['join_field'] = (isset($get['join_field'])) - ? ComponentbuilderHelper::safeString( + ? StringHelper::safe( $this->removeAsDot($get['join_field']) ) : null; $method['Join_field'] = (isset($method['join_field'])) - ? ComponentbuilderHelper::safeString($method['join_field'], 'F') + ? StringHelper::safe($method['join_field'], 'F') : null; - $method['name'] = ComponentbuilderHelper::safeString( + $method['name'] = StringHelper::safe( $get['selection']['name'], 'F' ); - $method['code'] = ComponentbuilderHelper::safeString($code); - $method['AS'] = ComponentbuilderHelper::safeString( + $method['code'] = StringHelper::safe($code); + $method['AS'] = StringHelper::safe( $get['as'], 'U' ); - $method['as'] = ComponentbuilderHelper::safeString( + $method['as'] = StringHelper::safe( $get['as'] ); $method['valueName'] = $method['on_field'] . $method['Join_field'] . $method['name'] . $method['AS']; - $method['methodName'] = ComponentbuilderHelper::safeString( + $method['methodName'] = StringHelper::safe( $method['on_field'], 'F' ) . $method['Join_field'] . $method['name'] . $key . '_' . $method['AS']; @@ -4802,7 +4829,7 @@ class Interpretation extends Fields public function setCustomViewListQuery(&$get, $code, $return = true) { - if (ComponentbuilderHelper::checkObject($get)) + if (ObjectHelper::check($get)) { if ($get->pagination == 1) { @@ -4889,7 +4916,7 @@ class Interpretation extends Fields $Component = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh]; // start load the get item - if (ComponentbuilderHelper::checkObject($get)) + if (ObjectHelper::check($get)) { $getItem .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -4906,7 +4933,7 @@ class Interpretation extends Fields $getItem .= PHP_EOL . $this->_t(4) . "\$item->slug = (isset(\$item->alias) && isset(\$item->id)) ? \$item->id.':'.\$item->alias : \$item->id;"; if (isset($get->main_get) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $get->main_get )) { @@ -4917,7 +4944,7 @@ class Interpretation extends Fields { $decodeChecker = $this->siteFieldData['decode'][$code][$main_get['key']][$main_get['as']]; - if (ComponentbuilderHelper::checkArray($decodeChecker)) + if (ArrayHelper::check($decodeChecker)) { // set decoding of needed fields $getItem .= $this->setCustomViewFieldDecode( @@ -4931,7 +4958,7 @@ class Interpretation extends Fields { $decodeFilter = $this->siteFieldDecodeFilter[$this->target][$code][$main_get['key']][$main_get['as']]; - if (ComponentbuilderHelper::checkArray($decodeFilter)) + if (ArrayHelper::check($decodeFilter)) { $getItem .= $this->setCustomViewFieldDecodeFilter( $main_get, $decodeFilter, "\$item", @@ -4943,7 +4970,7 @@ class Interpretation extends Fields { $contentprepareChecker = $this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']]; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $contentprepareChecker )) { @@ -4958,7 +4985,7 @@ class Interpretation extends Fields { $uikitChecker = $this->siteFieldData['uikit'][$code][$main_get['key']][$main_get['as']]; - if (ComponentbuilderHelper::checkArray($uikitChecker)) + if (ArrayHelper::check($uikitChecker)) { // set uikit checkers on needed fields $getItem .= $this->setCustomViewFieldUikitChecker( @@ -4976,7 +5003,7 @@ class Interpretation extends Fields { // check if the dispather should be added if (!isset($this->JEventDispatcher) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->JEventDispatcher )) { @@ -5002,7 +5029,7 @@ class Interpretation extends Fields $get->php_calculation = (array) explode( PHP_EOL, $get->php_calculation ); - if (ComponentbuilderHelper::checkArray($get->php_calculation)) + if (ArrayHelper::check($get->php_calculation)) { $_tmp = PHP_EOL . $this->_t(4) . implode( PHP_EOL . $this->_t(4), $get->php_calculation @@ -5114,12 +5141,12 @@ class Interpretation extends Fields { $method = ''; if (isset($view['settings']->main_get) - && ComponentbuilderHelper::checkObject($view['settings']->main_get)) + && ObjectHelper::check($view['settings']->main_get)) { // add events if needed if ($view['settings']->main_get->gettype == 1 - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->main_get->plugin_events )) { @@ -5156,7 +5183,7 @@ class Interpretation extends Fields } // add the custom get methods if (isset($view['settings']->custom_get) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->custom_get )) { @@ -5166,7 +5193,7 @@ class Interpretation extends Fields 'get', '', $custom_get->getcustom ); $method .= PHP_EOL . $this->_t(2) . "\$this->" - . ComponentbuilderHelper::safeString($custom_get_name) + . StringHelper::safe($custom_get_name) . " = \$this->get('" . $custom_get_name . "');"; } } @@ -5176,7 +5203,7 @@ class Interpretation extends Fields $view['settings']->php_jview_display = (array) explode( PHP_EOL, $view['settings']->php_jview_display ); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->php_jview_display )) { @@ -5228,7 +5255,7 @@ class Interpretation extends Fields $method .= PHP_EOL . $this->_t(2) . "}"; // add events if needed if ($view['settings']->main_get->gettype == 1 - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->main_get->plugin_events )) { @@ -5305,7 +5332,7 @@ class Interpretation extends Fields } // ensure correct target is set - $TARGET = ComponentbuilderHelper::safeString($this->target, 'U'); + $TARGET = StringHelper::safe($this->target, 'U'); // set libraries $TARGET.'_LIBRARIES_LOADER $this->fileContentDynamic[$view['settings']->code][$this->hhh . $TARGET @@ -5490,7 +5517,7 @@ class Interpretation extends Fields $view['settings']->php_document = (array) explode( PHP_EOL, $view['settings']->php_document ); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->php_document )) { @@ -5510,7 +5537,7 @@ class Interpretation extends Fields // do not validate selection $validateSelection = 'false'; // ensure correct target is set - $TARGET = ComponentbuilderHelper::safeString($this->target, 'U'); + $TARGET = StringHelper::safe($this->target, 'U'); if (1 == $type || 2 == $type) { if (1 == $type) @@ -5523,12 +5550,10 @@ class Interpretation extends Fields } // set the custom buttons CUSTOM_BUTTONS_CONTROLLER $this->fileContentDynamic[$viewCodeName][$this->hhh . $TARGET - . '_CUSTOM_BUTTONS_CONTROLLER' . $this->hhh] - = ''; + . '_CUSTOM_BUTTONS_CONTROLLER' . $this->hhh] = ''; // set the custom buttons CUSTOM_BUTTONS_METHOD $this->fileContentDynamic[$viewCodeName][$this->hhh . $TARGET - . '_CUSTOM_BUTTONS_METHOD' . $this->hhh] - = ''; + . '_CUSTOM_BUTTONS_METHOD' . $this->hhh] = ''; } elseif (3 == $type) { @@ -5620,7 +5645,7 @@ class Interpretation extends Fields $this->onlyFunctionButton = array(); $functionNames = array(); if (isset($view['settings']->custom_buttons) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->custom_buttons )) { @@ -5628,10 +5653,10 @@ class Interpretation extends Fields { // Load to lang $keyLang = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $custom_button['name'], 'U' ); - $keyCode = ComponentbuilderHelper::safeString( + $keyCode = StringHelper::safe( $custom_button['name'] ); $this->setLangContent( @@ -5749,7 +5774,7 @@ class Interpretation extends Fields { // insure the controller and model strings are added if (isset($view['settings']->php_controller_list) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view['settings']->php_controller_list ) && $view['settings']->php_controller_list != '//') @@ -5765,7 +5790,7 @@ class Interpretation extends Fields } // load the model if (isset($view['settings']->php_model_list) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view['settings']->php_model_list ) && $view['settings']->php_model_list != '//') @@ -5783,7 +5808,7 @@ class Interpretation extends Fields else { // insure the controller and model strings are added - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $view['settings']->php_controller ) && $view['settings']->php_controller != '//') @@ -5806,7 +5831,7 @@ class Interpretation extends Fields } } // load the model - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $view['settings']->php_model ) && $view['settings']->php_model != '//') @@ -5822,18 +5847,18 @@ class Interpretation extends Fields } } // return buttons if they were build - if (ComponentbuilderHelper::checkArray($buttons)) + if (ArrayHelper::check($buttons)) { // just to check if the submission script is manually added if (!isset($view['settings']->php_document) - || (ComponentbuilderHelper::checkArray( + || (ArrayHelper::check( $view['settings']->php_document ) && strpos( implode(' ', $view['settings']->php_document), '/submitbutton.js' ) === false) - || (ComponentbuilderHelper::checkString( + || (StringHelper::check( $view['settings']->php_document ) && strpos( @@ -5880,7 +5905,7 @@ class Interpretation extends Fields { // return buttons if they were build if (isset($this->onlyFunctionButton[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->onlyFunctionButton[$nameListCode] )) { @@ -5896,7 +5921,7 @@ class Interpretation extends Fields { if ($view['settings']->add_css == 1) { - if (ComponentbuilderHelper::checkString($view['settings']->css)) + if (StringHelper::check($view['settings']->css)) { return $this->setPlaceholders( $view['settings']->css, $this->placeholders @@ -5914,7 +5939,7 @@ class Interpretation extends Fields $view['settings']->css_document = (array) explode( PHP_EOL, $view['settings']->css_document ); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->css_document )) { @@ -5941,7 +5966,7 @@ class Interpretation extends Fields public function setJavaScriptFile(&$view, $TARGET) { if ($view['settings']->add_javascript_file == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $view['settings']->javascript_file )) { @@ -5992,7 +6017,7 @@ class Interpretation extends Fields $view['settings']->js_document = (array) explode( PHP_EOL, $view['settings']->js_document ); - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->js_document )) { @@ -6041,7 +6066,7 @@ class Interpretation extends Fields // if we do then it posibly can be that the metadata is loaded via that method // and we can load the full metadata structure with its vars if (isset($view['settings']->custom_get) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->custom_get )) { @@ -6255,18 +6280,18 @@ class Interpretation extends Fields } // check if this view should get libraries if (isset($this->libManager[$this->target][$code]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->libManager[$this->target][$code] )) { foreach ($this->libManager[$this->target][$code] as $id => $true) { if (isset($this->libraries[$id]) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $this->libraries[$id] ) && isset($this->libraries[$id]->document) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->libraries[$id]->document )) { @@ -6278,7 +6303,7 @@ class Interpretation extends Fields ); } elseif (isset($this->libraries[$id]) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $this->libraries[$id] ) && isset($this->libraries[$id]->how)) @@ -6300,7 +6325,7 @@ class Interpretation extends Fields { if (2 == $this->libraries[$id]->how && isset($this->libraries[$id]->conditions) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->libraries[$id]->conditions )) { @@ -6316,7 +6341,7 @@ class Interpretation extends Fields } // check if the document was build if (isset($this->libraries[$id]->document) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->libraries[$id]->document )) { @@ -6345,7 +6370,7 @@ class Interpretation extends Fields $this->libwarning[$id] = true; } // if there was any code added to document then set globaly - if (ComponentbuilderHelper::checkString($document)) + if (StringHelper::check($document)) { $this->libraries[$id]->document = $document; } @@ -6356,7 +6381,7 @@ class Interpretation extends Fields $scripts = array(); // load the urls if found if (isset($this->libraries[$id]->urls) - && ComponentbuilderHelper::checkArray($this->libraries[$id]->urls)) + && ArrayHelper::check($this->libraries[$id]->urls)) { // set all the files foreach ($this->libraries[$id]->urls as $url) @@ -6390,7 +6415,7 @@ class Interpretation extends Fields } // load the local files if found if (isset($this->libraries[$id]->files) - && ComponentbuilderHelper::checkArray($this->libraries[$id]->files)) + && ArrayHelper::check($this->libraries[$id]->files)) { // set all the files foreach ($this->libraries[$id]->files as $file) @@ -6419,7 +6444,7 @@ class Interpretation extends Fields } // load the local folders if found if (isset($this->libraries[$id]->folders) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->libraries[$id]->folders )) { @@ -6431,7 +6456,7 @@ class Interpretation extends Fields $path = '/' . trim($folder['path'], '/'); if (isset($folder['rename']) && 1 == $folder['rename']) { - if ($_paths = ComponentbuilderHelper::getAllFilePaths( + if ($_paths = FileHelper::getPaths( $this->componentPath . $path )) { @@ -6441,7 +6466,7 @@ class Interpretation extends Fields else { $path = $path . '/' . trim($folder['folder'], '/'); - if ($_paths = ComponentbuilderHelper::getAllFilePaths( + if ($_paths = FileHelper::getPaths( $this->componentPath . $path )) { @@ -6466,7 +6491,7 @@ class Interpretation extends Fields } } // if there was any code added to document then set globaly - if ($buildDoc && ComponentbuilderHelper::checkArray($scripts)) + if ($buildDoc && ArrayHelper::check($scripts)) { $this->libraries[$id]->document = $this->_t(2) . "//" . $this->setLine(__LINE__) . " always load these files." @@ -6477,7 +6502,7 @@ class Interpretation extends Fields // success return true; } - elseif (ComponentbuilderHelper::checkArray($scripts)) + elseif (ArrayHelper::check($scripts)) { return $scripts; } @@ -6635,7 +6660,7 @@ class Interpretation extends Fields // load the components need if ((2 == $this->uikit || 1 == $this->uikit) && isset($this->uikitComp[$view['settings']->code]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->uikitComp[$view['settings']->code] )) { @@ -6656,7 +6681,7 @@ class Interpretation extends Fields } // check content for more needed components if (isset($this->siteFieldData['uikit'][$view['settings']->code]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->siteFieldData['uikit'][$view['settings']->code] )) { @@ -6758,7 +6783,7 @@ class Interpretation extends Fields } elseif ((2 == $this->uikit || 1 == $this->uikit) && isset($this->siteFieldData['uikit'][$view['settings']->code]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->siteFieldData['uikit'][$view['settings']->code] )) { @@ -6899,7 +6924,7 @@ class Interpretation extends Fields public function setCustomViewBody(&$view) { - if (ComponentbuilderHelper::checkString($view['settings']->default)) + if (StringHelper::check($view['settings']->default)) { if ($view['settings']->main_get->gettype == 2 && $view['settings']->main_get->pagination == 1) @@ -7110,7 +7135,7 @@ class Interpretation extends Fields public function setCustomViewSubmitButtonScript(&$view) { - if (ComponentbuilderHelper::checkString($view['settings']->default)) + if (StringHelper::check($view['settings']->default)) { // add the script only if there is none set if (strpos( @@ -7149,7 +7174,7 @@ class Interpretation extends Fields $view['settings']->php_view = (array) explode( PHP_EOL, $view['settings']->php_view ); - if (ComponentbuilderHelper::checkArray($view['settings']->php_view)) + if (ArrayHelper::check($view['settings']->php_view)) { $_tmp = PHP_EOL . PHP_EOL . implode( PHP_EOL, $view['settings']->php_view @@ -7165,7 +7190,7 @@ class Interpretation extends Fields public function setCustomViewTemplateBody(&$view) { if (isset($this->templateData[$this->target][$view['settings']->code]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->templateData[$this->target][$view['settings']->code] )) { @@ -7186,7 +7211,7 @@ class Interpretation extends Fields . $this->hhh => $view['settings']->version); $this->buildDynamique($target, 'template', $template, $config); // set the file data - $TARGET = ComponentbuilderHelper::safeString( + $TARGET = StringHelper::safe( $this->target, 'U' ); // SITE_TEMPLATE_BODY <<>> @@ -7207,10 +7232,10 @@ class Interpretation extends Fields public function setCustomViewTemplateCode(&$php) { - if (ComponentbuilderHelper::checkString($php)) + if (StringHelper::check($php)) { $php_view = (array) explode(PHP_EOL, $php); - if (ComponentbuilderHelper::checkArray($php_view)) + if (ArrayHelper::check($php_view)) { $php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view); @@ -7224,7 +7249,7 @@ class Interpretation extends Fields public function setCustomViewLayouts() { if (isset($this->layoutData[$this->target]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->layoutData[$this->target] )) { @@ -7234,12 +7259,12 @@ class Interpretation extends Fields $target = array($this->target => $layout); $this->buildDynamique($target, 'layout'); // set the file data - $TARGET = ComponentbuilderHelper::safeString( + $TARGET = StringHelper::safe( $this->target, 'U' ); // SITE_LAYOUT_CODE <<>> $php_view = (array) explode(PHP_EOL, $data['php_view']); - if (ComponentbuilderHelper::checkArray($php_view)) + if (ArrayHelper::check($php_view)) { $php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view); $this->fileContentDynamic[$layout][$this->hhh . $TARGET @@ -7278,13 +7303,13 @@ class Interpretation extends Fields foreach ($files as $view => $file) { if (isset($file['path']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $file )) { if (File::exists($file['path'])) { - $string = ComponentbuilderHelper::getFileContents( + $string = FileHelper::getContent( $file['path'] ); $buket['static'][] = $this->getInbetweenStrings( @@ -7292,16 +7317,16 @@ class Interpretation extends Fields ); } } - elseif (ComponentbuilderHelper::checkArray($file)) + elseif (ArrayHelper::check($file)) { foreach ($file as $nr => $doc) { - if (ComponentbuilderHelper::checkArray($doc)) + if (ArrayHelper::check($doc)) { if (File::exists($doc['path'])) { $string - = ComponentbuilderHelper::getFileContents( + = FileHelper::getContent( $doc['path'] ); $buket[$view][] = $this->getInbetweenStrings( @@ -7350,7 +7375,7 @@ class Interpretation extends Fields . $this->hhh]; // go from base64 to string if (isset($this->base64Builder[$view]) - && ComponentbuilderHelper::checkArray($this->base64Builder[$view])) + && ArrayHelper::check($this->base64Builder[$view])) { foreach ($this->base64Builder[$view] as $baseString) { @@ -7370,7 +7395,7 @@ class Interpretation extends Fields foreach ($this->cryptionTypes as $cryptionType) { if (isset($this->{$cryptionType . 'FieldModeling'}[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->{$cryptionType . 'FieldModeling'}[$view] )) { @@ -7446,7 +7471,7 @@ class Interpretation extends Fields } // go from json to array if (isset($this->jsonItemBuilder[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->jsonItemBuilder[$view] )) { @@ -7469,7 +7494,7 @@ class Interpretation extends Fields } // go from json to string if (isset($this->jsonStringBuilder[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->jsonStringBuilder[$view] )) { @@ -7483,7 +7508,7 @@ class Interpretation extends Fields __LINE__ ) . " JSON Decode " . $jsonString . "."; if (isset($this->jsonItemBuilderArray[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->jsonItemBuilderArray[$view] ) && in_array( @@ -7529,7 +7554,7 @@ class Interpretation extends Fields { $script = ''; if (isset($this->checkboxBuilder[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->checkboxBuilder[$view] )) { @@ -7563,7 +7588,7 @@ class Interpretation extends Fields ); // turn array into JSON string if (isset($this->jsonItemBuilder[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->jsonItemBuilder[$view] )) { @@ -7585,7 +7610,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(2) . "}"; if (isset($this->permissionFields[$view]) && isset($this->permissionFields[$view][$jsonItem]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionFields[$view][$jsonItem] )) { @@ -7629,7 +7654,7 @@ class Interpretation extends Fields } // turn string into json string if (isset($this->jsonStringBuilder[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->jsonStringBuilder[$view] )) { @@ -7649,7 +7674,7 @@ class Interpretation extends Fields } // turn string into base 64 string if (isset($this->base64Builder[$view]) - && ComponentbuilderHelper::checkArray($this->base64Builder[$view])) + && ArrayHelper::check($this->base64Builder[$view])) { foreach ($this->base64Builder[$view] as $baseString) { @@ -7668,7 +7693,7 @@ class Interpretation extends Fields foreach ($this->cryptionTypes as $cryptionType) { if (isset($this->{$cryptionType . 'FieldModeling'}[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->{$cryptionType . 'FieldModeling'}[$view] )) { @@ -7758,7 +7783,7 @@ class Interpretation extends Fields $component = $this->componentCodeName; // add the tags observer if (isset($this->tagsBuilder[$view]) - && ComponentbuilderHelper::checkString($this->tagsBuilder[$view])) + && StringHelper::check($this->tagsBuilder[$view])) { $oserver .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Adding Tag Options"; @@ -7768,7 +7793,7 @@ class Interpretation extends Fields } // add the history/version observer if (isset($this->historyBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->historyBuilder[$view] )) { @@ -7799,7 +7824,7 @@ class Interpretation extends Fields { $script = ''; if (isset($this->componentData->admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->admin_views )) { @@ -7811,21 +7836,21 @@ class Interpretation extends Fields foreach ($this->componentData->admin_views as $viewData) { // set main keys - $view = ComponentbuilderHelper::safeString( + $view = StringHelper::safe( $viewData['settings']->name_single ); // set list view keys - $views = ComponentbuilderHelper::safeString( + $views = StringHelper::safe( $viewData['settings']->name_list ); // get this views content type data $dbStuff[$view] = $this->getContentType($view, $component); // get the correct views name $checkViews = (isset($this->catCodeBuilder[$view]['views']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->catCodeBuilder[$view]['views'] )) ? $this->catCodeBuilder[$view]['views'] : $views; - if (ComponentbuilderHelper::checkArray($dbStuff[$view]) + if (ArrayHelper::check($dbStuff[$view]) && array_key_exists($view, $this->catCodeBuilder) && ($checkViews == $views)) { @@ -7835,14 +7860,14 @@ class Interpretation extends Fields ); } elseif (!isset($dbStuff[$view]) - || !ComponentbuilderHelper::checkArray($dbStuff[$view])) + || !ArrayHelper::check($dbStuff[$view])) { // remove if not array unset($dbStuff[$view]); } } // build the db insert query - if (ComponentbuilderHelper::checkArray($dbStuff)) + if (ArrayHelper::check($dbStuff)) { $taabb = ''; if ($action === 'update') @@ -7855,9 +7880,9 @@ class Interpretation extends Fields . "\$db = JFactory::getDbo();"; foreach ($dbStuff as $name => $tables) { - if (ComponentbuilderHelper::checkArray($tables)) + if (ArrayHelper::check($tables)) { - $code = ComponentbuilderHelper::safeString($name); + $code = StringHelper::safe($name); $script .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Create the " . $name . " content type object."; @@ -7935,11 +7960,11 @@ class Interpretation extends Fields // add the assets table update for permissions rules if (isset($this->assetsRules) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->assetsRules )) { - if (ComponentbuilderHelper::checkString($script)) + if (StringHelper::check($script)) { $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ @@ -7949,7 +7974,7 @@ class Interpretation extends Fields { $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Install the global extenstion assets permission."; + ) . " Install the global extension assets permission."; $script .= PHP_EOL . $this->_t(3) . "\$db = JFactory::getDbo();"; } @@ -7978,9 +8003,9 @@ class Interpretation extends Fields } // add the global params for the component global settings if (isset($this->extensionsParams) - && ComponentbuilderHelper::checkArray($this->extensionsParams)) + && ArrayHelper::check($this->extensionsParams)) { - if (ComponentbuilderHelper::checkString($script)) + if (StringHelper::check($script)) { $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ @@ -8023,7 +8048,7 @@ class Interpretation extends Fields // add the Intelligent Fix script if needed $script .= $this->getAssetsTableIntelligentInstall(); // add the component install notice - if (ComponentbuilderHelper::checkString($script)) + if (StringHelper::check($script)) { $script .= PHP_EOL . $this->_t(3) . 'echo \'';"; } - if (ComponentbuilderHelper::checkString($script)) + if (StringHelper::check($script)) { return $script; } @@ -8086,7 +8111,7 @@ class Interpretation extends Fields // reset script $script = ''; if (isset($this->uninstallScriptBuilder) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->uninstallScriptBuilder )) { @@ -8106,7 +8131,7 @@ class Interpretation extends Fields ) { // set a var value - $view = ComponentbuilderHelper::safeString($viewsCodeName); + $view = StringHelper::safe($viewsCodeName); // check if it has field relations if (isset($this->uninstallScriptFields) @@ -8693,8 +8718,8 @@ class Interpretation extends Fields $script[] = $messageA; $script[] = $this->_t($tab) . $this->_t(2) . "}"; // only ad this if there is a B part - if (ComponentbuilderHelper::checkString($codeB) - || ComponentbuilderHelper::checkString($messageB)) + if (StringHelper::check($codeB) + || StringHelper::check($messageB)) { $script[] = $this->_t($tab) . $this->_t(2) . "else"; $script[] = $this->_t($tab) . $this->_t(2) . "{"; @@ -8792,11 +8817,11 @@ class Interpretation extends Fields { // add if history is to be kept or if tags is added if ((isset($this->historyBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->historyBuilder[$view] )) || (isset($this->tagsBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->tagsBuilder[$view] ))) { @@ -8814,28 +8839,28 @@ class Interpretation extends Fields '{"sourceColumn": "' . $category . '","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},' : ''; - $Component = ComponentbuilderHelper::safeString( + $Component = StringHelper::safe( $component, 'F' ); - $View = ComponentbuilderHelper::safeString($view, 'F'); + $View = StringHelper::safe($view, 'F'); $maintext = (isset($this->maintextBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->maintextBuilder[$view] )) ? $this->maintextBuilder[$view] : 'null'; $hiddenFields = (isset($this->hiddenFieldsBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->hiddenFieldsBuilder[$view] )) ? $this->hiddenFieldsBuilder[$view] : ''; $dynamicfields = (isset($this->dynamicfieldsBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->dynamicfieldsBuilder[$view] )) ? $this->dynamicfieldsBuilder[$view] : ''; $intFields = (isset($this->intFieldsBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->intFieldsBuilder[$view] )) ? $this->intFieldsBuilder[$view] : ''; $customfieldlinks = (isset($this->customFieldLinksBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->customFieldLinksBuilder[$view] )) ? $this->customFieldLinksBuilder[$view] : ''; // build uninstall script for content types @@ -8844,7 +8869,7 @@ class Interpretation extends Fields $this->uninstallScriptContent[$view] = $view; // check if this view has metadata if (isset($this->metadataBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->metadataBuilder[$view] )) { @@ -8860,7 +8885,7 @@ class Interpretation extends Fields } // check if view has access if (isset($this->accessBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$view] )) { @@ -8925,8 +8950,8 @@ class Interpretation extends Fields // get the other view $otherView = $this->catCodeBuilder[$view]['view']; $category = $this->catCodeBuilder[$view]['code']; - $Component = ComponentbuilderHelper::safeString($component, 'F'); - $View = ComponentbuilderHelper::safeString($view, 'F'); + $Component = StringHelper::safe($component, 'F'); + $View = StringHelper::safe($view, 'F'); // build uninstall script for content types $this->uninstallScriptBuilder[$View . ' ' . $category] = 'com_' . $component . '.' . $otherView . '.category'; @@ -8934,7 +8959,7 @@ class Interpretation extends Fields . $category; // set the title $array['type_title'] = $Component . ' ' . $View . ' ' - . ComponentbuilderHelper::safeString($category, 'F'); + . StringHelper::safe($category, 'F'); // set the alias $array['type_alias'] = 'com_' . $component . '.' . $otherView . '.category'; @@ -8959,7 +8984,7 @@ class Interpretation extends Fields { // add if tags is added, also for all front item views if (((isset($this->tagsBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->tagsBuilder[$nameSingleCode] )) || $front) @@ -8968,7 +8993,7 @@ class Interpretation extends Fields // insure we load a view only once $this->setRouterHelpDone[] = $nameSingleCode; // build view route helper - $View = ComponentbuilderHelper::safeString( + $View = StringHelper::safe( $nameSingleCode, 'F' ); $routeHelper = array(); @@ -9067,7 +9092,7 @@ class Interpretation extends Fields $routerSwitch = array(); $isCategory = ''; $viewTable = false; - if ($viewArray && ComponentbuilderHelper::checkArray($viewArray) + if ($viewArray && ArrayHelper::check($viewArray) && isset($viewArray['settings']) && isset($viewArray['settings']->main_get)) { @@ -9075,7 +9100,7 @@ class Interpretation extends Fields if (isset($viewArray['settings']->main_get->add_php_router_parse) && $viewArray['settings']->main_get->add_php_router_parse == 1 && isset($viewArray['settings']->main_get->php_router_parse) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $viewArray['settings']->main_get->php_router_parse )) { @@ -9099,7 +9124,7 @@ class Interpretation extends Fields } // get the main table name elseif (isset($viewArray['settings']->main_get->main_get) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $viewArray['settings']->main_get->main_get )) { @@ -9108,11 +9133,11 @@ class Interpretation extends Fields if (isset($get['as']) && $get['as'] === 'a') { if (isset($get['selection']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $get['selection'] ) && isset($get['selection']['select_gets']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $get['selection']['select_gets'] )) { @@ -9193,7 +9218,7 @@ class Interpretation extends Fields $this->fileContentStatic[$this->hhh . 'ROUTER_BUILD_VIEWS' . $this->hhh] ) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->fileContentStatic[$this->hhh . 'ROUTER_BUILD_VIEWS' . $this->hhh] )) @@ -9211,7 +9236,7 @@ class Interpretation extends Fields // set needed defaults $category = false; $batchmove = array(); - $VIEW = ComponentbuilderHelper::safeString($nameSingleCode, 'U'); + $VIEW = StringHelper::safe($nameSingleCode, 'U'); // component helper name $Helper = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper'; @@ -9266,7 +9291,7 @@ class Interpretation extends Fields if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -9293,7 +9318,7 @@ class Interpretation extends Fields . " make sure published only updates if user has the permission."; if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( @@ -9347,7 +9372,7 @@ class Interpretation extends Fields $batchmove[] = $this->_t(2) . "{"; if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit']] ) && in_array( @@ -9459,7 +9484,7 @@ class Interpretation extends Fields $alias = false; $category = false; $batchcopy = array(); - $VIEW = ComponentbuilderHelper::safeString($nameSingleCode, 'U'); + $VIEW = StringHelper::safe($nameSingleCode, 'U'); // component helper name $Helper = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper'; @@ -9545,7 +9570,7 @@ class Interpretation extends Fields $batchcopy[] = $this->_t(2) . "}"; if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -9582,7 +9607,7 @@ class Interpretation extends Fields $batchcopy[] = $this->_t(2) . "}"; if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( @@ -9642,7 +9667,7 @@ class Interpretation extends Fields . " only allow copy if user may edit this item."; if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit']] ) && in_array( @@ -9858,7 +9883,7 @@ class Interpretation extends Fields // set needed defaults $setCategory = false; $alias = $this->aliasBuilder[$nameSingleCode]; - $VIEW = ComponentbuilderHelper::safeString( + $VIEW = StringHelper::safe( $nameSingleCode, 'U' ); if (array_key_exists($nameSingleCode, $this->catCodeBuilder)) @@ -10191,7 +10216,7 @@ class Interpretation extends Fields // reset the bucket $titleData = array(); // load the dynamic title builder - if (isset($titles) && ComponentbuilderHelper::checkArray($titles)) + if (isset($titles) && ArrayHelper::check($titles)) { foreach ($titles as $title) { @@ -10253,7 +10278,7 @@ class Interpretation extends Fields public function setInstall() { if (isset($this->queryBuilder) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->queryBuilder )) { @@ -10350,7 +10375,7 @@ class Interpretation extends Fields // check if this a new field that should be added via SQL update if (isset($this->addSQL['field']) && isset($this->addSQL['field'][$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->addSQL['field'][$view] ) && in_array($data['ID'], $this->addSQL['field'][$view])) @@ -10472,7 +10497,7 @@ class Interpretation extends Fields } // check if view has access if (isset($this->accessBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$view] ) && !isset($this->fieldsNames[$view]['access'])) @@ -10488,7 +10513,7 @@ class Interpretation extends Fields } // check if metadata is added to this view if (isset($this->metadataBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->metadataBuilder[$view] )) { @@ -10516,7 +10541,7 @@ class Interpretation extends Fields // check if a key was set for any of the default fields then we should not set it again $check_keys_set = array(); if (isset($this->dbUniqueKeys[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->dbUniqueKeys[$view] )) { @@ -10528,7 +10553,7 @@ class Interpretation extends Fields } } if (isset($this->dbKeys[$view]) - && ComponentbuilderHelper::checkArray($this->dbKeys[$view])) + && ArrayHelper::check($this->dbKeys[$view])) { foreach ($this->dbKeys[$view] as $nr => $key) { @@ -10540,7 +10565,7 @@ class Interpretation extends Fields // check if view has access if (!isset($check_keys_set['access']) && isset($this->accessBuilder[$view]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$view] )) { @@ -10579,7 +10604,7 @@ class Interpretation extends Fields ) { if (isset($this->mysqlTableSetting[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->mysqlTableSetting[$view] ) && isset($this->mysqlTableSetting[$view][$_mysqlTableKey])) @@ -10594,7 +10619,7 @@ class Interpretation extends Fields } } // add a little fix for the row_format - if (ComponentbuilderHelper::checkString($easy['row_format'])) + if (StringHelper::check($easy['row_format'])) { $easy['row_format'] = ' ROW_FORMAT=' . $easy['row_format']; } @@ -10606,7 +10631,7 @@ class Interpretation extends Fields // check if this is a new table that should be added via update SQL if (isset($this->addSQL['adminview']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->addSQL['adminview'] ) && in_array($view, $this->addSQL['adminview'])) @@ -10617,7 +10642,7 @@ class Interpretation extends Fields = $db_; } // check if the table row_format has changed - if (ComponentbuilderHelper::checkString($easy['row_format']) + if (StringHelper::check($easy['row_format']) && isset($this->updateSQL['table_row_format']) && isset($this->updateSQL['table_row_format'][$view])) { @@ -10657,7 +10682,7 @@ class Interpretation extends Fields } // add custom sql dump to the file if (isset($this->customScriptBuilder['sql']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customScriptBuilder['sql'] )) { @@ -10760,7 +10785,7 @@ class Interpretation extends Fields { $db = ''; if (isset($this->queryBuilder) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->queryBuilder )) { @@ -10771,7 +10796,7 @@ class Interpretation extends Fields } // add custom sql uninstall dump to the file if (isset($this->customScriptBuilder['sql_uninstall']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->customScriptBuilder['sql_uninstall'] )) { @@ -11071,7 +11096,7 @@ class Interpretation extends Fields } // check if the both array is set if (isset($this->langContent['both']) - && ComponentbuilderHelper::checkArray($this->langContent['both'])) + && ArrayHelper::check($this->langContent['both'])) { foreach ($this->langContent['both'] as $keylang => $langval) { @@ -11080,7 +11105,7 @@ class Interpretation extends Fields } // check if the both admin array is set if (isset($this->langContent['bothadmin']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->langContent['bothadmin'] )) { @@ -11090,7 +11115,7 @@ class Interpretation extends Fields } } if (isset($this->langContent['admin']) - && ComponentbuilderHelper::checkArray($this->langContent['admin'])) + && ArrayHelper::check($this->langContent['admin'])) { // Trigger Event: jcb_ce_onAfterBuildAdminLang $this->triggerEvent( @@ -11166,7 +11191,7 @@ class Interpretation extends Fields // check if the both array is set if (isset($this->langContent['both']) - && ComponentbuilderHelper::checkArray($this->langContent['both'])) + && ArrayHelper::check($this->langContent['both'])) { foreach ($this->langContent['both'] as $keylang => $langval) { @@ -11175,7 +11200,7 @@ class Interpretation extends Fields } // check if the both site array is set if (isset($this->langContent['bothsite']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->langContent['bothsite'] )) { @@ -11185,7 +11210,7 @@ class Interpretation extends Fields } } if (isset($this->langContent['site']) - && ComponentbuilderHelper::checkArray($this->langContent['site'])) + && ArrayHelper::check($this->langContent['site'])) { // Trigger Event: jcb_ce_onAfterBuildSiteLang $this->triggerEvent( @@ -11230,7 +11255,7 @@ class Interpretation extends Fields // check if the both site array is set if (isset($this->langContent['bothsite']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->langContent['bothsite'] )) { @@ -11240,7 +11265,7 @@ class Interpretation extends Fields } } if (isset($this->langContent['sitesys']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->langContent['sitesys'] )) { @@ -11276,7 +11301,7 @@ class Interpretation extends Fields ); // check if the both admin array is set if (isset($this->langContent['bothadmin']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->langContent['bothadmin'] )) { @@ -11286,7 +11311,7 @@ class Interpretation extends Fields } } if (isset($this->langContent['adminsys']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->langContent['adminsys'] )) { @@ -11313,7 +11338,7 @@ class Interpretation extends Fields public function setCustomAdminViewListLink($view, $nameListCode) { if (isset($this->componentData->custom_admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->custom_admin_views )) { @@ -11322,7 +11347,7 @@ class Interpretation extends Fields ) { if (isset($custom_admin_view['adminviews']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $custom_admin_view['adminviews'] )) { @@ -11333,7 +11358,7 @@ class Interpretation extends Fields { // set the needed keys $setId = false; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $custom_admin_view['settings']->main_get->filter )) { @@ -11392,7 +11417,7 @@ class Interpretation extends Fields public function setListBody($nameSingleCode, $nameListCode) { if (isset($this->listBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->listBuilder[$nameListCode] )) { @@ -11430,7 +11455,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( @@ -11476,7 +11501,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -11555,7 +11580,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( @@ -11653,7 +11678,7 @@ class Interpretation extends Fields && $this->fieldRelations[$nameListCode][(int) $item['id']][2]['join_type'] == 2 && isset($this->fieldRelations[$nameListCode][(int) $item['id']][2]['set']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->fieldRelations[$nameListCode][(int) $item['id']][2]['set'] )); // load the main list view field @@ -11670,7 +11695,7 @@ class Interpretation extends Fields } // now load the relations if (isset($this->fieldRelations[$nameListCode][(int) $item['id']][2]['joinfields']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->fieldRelations[$nameListCode][(int) $item['id']][2]['joinfields'] )) { @@ -11714,7 +11739,7 @@ class Interpretation extends Fields ) . PHP_EOL . $this->_t(3) . ""; } elseif (isset($this->fieldRelations[$nameListCode][(int) $item['id']]['set']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->fieldRelations[$nameListCode][(int) $item['id']][2]['set'] )) { @@ -11766,7 +11791,7 @@ class Interpretation extends Fields ); // add default links $defaultLink = true; - if (ComponentbuilderHelper::checkString($refview) + if (StringHelper::check($refview) && isset($item['custom']) && isset($item['custom']['view']) && $refview === $item['custom']['view']) @@ -11775,7 +11800,7 @@ class Interpretation extends Fields } // is this a linked item if (($item['link'] - || (ComponentbuilderHelper::checkArray( + || (ArrayHelper::check( $item['custom'] ) && $item['custom']['extends'] === 'user')) @@ -11874,7 +11899,7 @@ class Interpretation extends Fields $customAdminViewButton = ''; // check if custom links should be added to this list views if (isset($this->customAdminViewListLink[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customAdminViewListLink[$nameListCode] )) { @@ -11932,11 +11957,11 @@ class Interpretation extends Fields { // first update the code id needed if (isset($item['custom']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $item['custom'] ) && isset($item['custom']['table']) - && ComponentbuilderHelper::checkString($item['custom']['table'])) + && StringHelper::check($item['custom']['table'])) { $item['id_code'] = $item['code']; if (!$item['multiple']) @@ -11956,7 +11981,7 @@ class Interpretation extends Fields } // check if custom user elseif (isset($item['custom']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $item['custom'] ) && $item['custom']['extends'] === 'user' @@ -11967,7 +11992,7 @@ class Interpretation extends Fields } // check if translated value is used elseif (isset($this->selectionTranslationFixBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->selectionTranslationFixBuilder[$nameListCode] ) && array_key_exists( @@ -11978,7 +12003,7 @@ class Interpretation extends Fields return 'JText:' . ':_($item->' . $item['code'] . ')'; } elseif (isset($item['custom']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $item['custom'] ) && $item['custom']['text'] === 'user') @@ -12039,7 +12064,7 @@ class Interpretation extends Fields . $item['code'] . ' ?>'; } elseif (isset($item['custom']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $item['custom'] ) && $item['custom']['extends'] != 'user' @@ -12053,7 +12078,7 @@ class Interpretation extends Fields . $ref; } elseif (isset($item['custom']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $item['custom'] ) && $item['custom']['extends'] === 'user' @@ -12105,7 +12130,7 @@ class Interpretation extends Fields return $user . "->authorise('core.edit', 'com_users')"; } elseif (isset($item['custom']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $item['custom'] ) && $item['custom']['extends'] != 'user' @@ -12123,7 +12148,7 @@ class Interpretation extends Fields if ($coreLoadLink && (isset($coreLink['core.edit']) && isset($this->permissionBuilder[$coreLink['core.edit']])) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$coreLink['core.edit']] ) && in_array( @@ -12143,7 +12168,7 @@ class Interpretation extends Fields . ".' . (int)\$item->" . $item['id_code'] . ")"; } elseif (isset($item['custom']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $item['custom'] ) && $item['custom']['extends'] === 'user' @@ -12156,7 +12181,7 @@ class Interpretation extends Fields // check if the item has custom permissions. elseif ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -12383,7 +12408,7 @@ class Interpretation extends Fields public function setListHead($nameSingleCode, $nameListCode) { if (isset($this->listBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->listBuilder[$nameListCode] )) { @@ -12401,7 +12426,7 @@ class Interpretation extends Fields } // main lang prefix $langView = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString($nameSingleCode, 'U'); + . StringHelper::safe($nameSingleCode, 'U'); // set status lang $statusLangName = $langView . '_STATUS'; // set id lang @@ -12450,7 +12475,7 @@ class Interpretation extends Fields { // check if we have an over-ride if (isset($this->listHeadOverRide[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->listHeadOverRide[$nameListCode] ) && isset($this->listHeadOverRide[$nameListCode][$item['id']])) @@ -12476,7 +12501,7 @@ class Interpretation extends Fields . "', \$this->listDirn, \$this->listOrder); ?>"; } // set the custom code - elseif (ComponentbuilderHelper::checkArray( + elseif (ArrayHelper::check( $item['custom'] )) { @@ -12567,7 +12592,7 @@ class Interpretation extends Fields { // check if the load build is set for this view if (isset($this->layoutBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->layoutBuilder[$nameSingleCode] )) { @@ -12599,7 +12624,7 @@ class Interpretation extends Fields } // add the layout key $layoutArray[] = PHP_EOL . $this->_t(2) . "'" - . ComponentbuilderHelper::safeString($layout) + . StringHelper::safe($layout) . "' => array(" . implode(',', $alignmentArray) . PHP_EOL . $this->_t(2) . ")"; } @@ -12626,10 +12651,10 @@ class Interpretation extends Fields $nameSingleCode = $view['settings']->name_single_code; // main lang prefix $langView = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString($nameSingleCode, 'U'); + . StringHelper::safe($nameSingleCode, 'U'); // check if the load build is set for this view if (isset($this->layoutBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->layoutBuilder[$nameSingleCode] )) { @@ -12665,7 +12690,7 @@ class Interpretation extends Fields } // start building body $body = PHP_EOL . '
'; - if (ComponentbuilderHelper::checkString($span)) + if (StringHelper::check($span)) { $body .= PHP_EOL . $this->_t(1) . '
'; } @@ -12697,7 +12722,7 @@ class Interpretation extends Fields } // if this is a linked view set permissions $closeIT = false; - if (ComponentbuilderHelper::checkArray($linkedViewIdentifier) + if (ArrayHelper::check($linkedViewIdentifier) && in_array($tabCodeName, $linkedViewIdentifier)) { // get view name @@ -12705,7 +12730,7 @@ class Interpretation extends Fields $tabCodeName, $linkedViewIdentifier ); $linkedViewData = $this->getAdminViewData($linkedViewId); - $linkedCodeName = ComponentbuilderHelper::safeString( + $linkedCodeName = StringHelper::safe( $linkedViewData->name_single ); // setup correct core target @@ -12718,7 +12743,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoadLinked && isset($coreLinked['core.access']) && isset($this->permissionBuilder['global'][$coreLinked['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$coreLinked['core.access']] ) && in_array( @@ -12801,7 +12826,7 @@ class Interpretation extends Fields . ""; $body .= PHP_EOL . $this->_t(1) . "
"; // close divs - if (ComponentbuilderHelper::checkString($span)) + if (StringHelper::check($span)) { $body .= PHP_EOL . $this->_t(1) . "
"; } @@ -12853,7 +12878,7 @@ class Interpretation extends Fields $linkedTab = array(); // check if the view has linked admin view if (isset($this->linkedAdminViews[$nameSingleCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->linkedAdminViews[$nameSingleCode] )) { @@ -12867,8 +12892,8 @@ class Interpretation extends Fields // add the linked view $linkedTab[$linkedView['adminview']] = $linkedView['tab']; // set the keys if values are set - if (ComponentbuilderHelper::checkString($linkedView['key']) - && ComponentbuilderHelper::checkString( + if (StringHelper::check($linkedView['key']) + && StringHelper::check( $linkedView['parentkey'] )) { @@ -12931,11 +12956,11 @@ class Interpretation extends Fields $tabWidth = 12; $lrCounter = 0; // set tab lang - $tabLangName = $langView . '_' . ComponentbuilderHelper::safeString( + $tabLangName = $langView . '_' . StringHelper::safe( $tabName, 'U' ); // set tab code name - $tabCodeName = ComponentbuilderHelper::safeString($tabName); + $tabCodeName = StringHelper::safe($tabName); /// set the values to use in search latter $searchTabs[$tabCodeName] = $tabNr; // add to lang array @@ -12943,7 +12968,7 @@ class Interpretation extends Fields // check if linked view belongs to this tab $buildLayout = true; $linkedViewId = ''; - if (ComponentbuilderHelper::checkArray($linkedTab)) + if (ArrayHelper::check($linkedTab)) { if (($linkedViewId = array_search($tabNr, $linkedTab)) !== false) @@ -13083,7 +13108,7 @@ class Interpretation extends Fields // set identifiers $linkedViewIdentifier[$linkedViewId] = $tabCodeName; //set function name - $codeName = ComponentbuilderHelper::safeString( + $codeName = StringHelper::safe( $this->uniquekey(3) . $tabCodeName ); // set as items layout @@ -13235,7 +13260,7 @@ class Interpretation extends Fields } } // set switch to trigger notice if custom fields added to right - if (ComponentbuilderHelper::checkArray($items['right'])) + if (ArrayHelper::check($items['right'])) { $fieldsAddedRight = true; } @@ -13259,7 +13284,7 @@ class Interpretation extends Fields } elseif ($defaultField === 'access' && isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] )) { @@ -13270,7 +13295,7 @@ class Interpretation extends Fields } // check if metadata is added to this view if (isset($this->metadataBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->metadataBuilder[$nameSingleCode] )) { @@ -13278,18 +13303,18 @@ class Interpretation extends Fields $tabCodeNameLeft = 'publishing'; $tabCodeNameRight = 'metadata'; // the default publishing tiems - if (ComponentbuilderHelper::checkArray($items['left']) - || ComponentbuilderHelper::checkArray($items['right'])) + if (ArrayHelper::check($items['left']) + || ArrayHelper::check($items['right'])) { $items_one = ''; // load the items into one side - if (ComponentbuilderHelper::checkArray($items['left'])) + if (ArrayHelper::check($items['left'])) { $items_one .= "'" . implode( "'," . PHP_EOL . $this->_t(1) . "'", $items['left'] ) . "'"; } - if (ComponentbuilderHelper::checkArray($items['right'])) + if (ArrayHelper::check($items['right'])) { // there is already fields just add these if (strlen($items_one) > 3) @@ -13345,11 +13370,11 @@ class Interpretation extends Fields $tabCodeNameLeft = 'publishing'; $tabCodeNameRight = 'publlshing'; // the default publishing tiems - if (ComponentbuilderHelper::checkArray($items['left']) - || ComponentbuilderHelper::checkArray($items['right'])) + if (ArrayHelper::check($items['left']) + || ArrayHelper::check($items['right'])) { // load left items that remain - if (ComponentbuilderHelper::checkArray($items['left'])) + if (ArrayHelper::check($items['left'])) { // load all items $items_one = "'" . implode( @@ -13363,7 +13388,7 @@ class Interpretation extends Fields $items_one = true; } // load right items that remain - if (ComponentbuilderHelper::checkArray($items['right'])) + if (ArrayHelper::check($items['right'])) { // load all items $items_two = "'" . implode( @@ -13410,7 +13435,7 @@ class Interpretation extends Fields { if ($coreLoad && isset($core[$core_permission]) && isset($this->permissionBuilder['global'][$core[$core_permission]]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core[$core_permission]] ) && in_array( @@ -13436,7 +13461,7 @@ class Interpretation extends Fields { if ($coreLoad && isset($core[$core_permission]) && isset($this->permissionBuilder['global'][$core[$core_permission]]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core[$core_permission]] ) && in_array( @@ -13554,20 +13579,20 @@ class Interpretation extends Fields { // check if this view is having custom tabs if (isset($this->customTabs[$name_single]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customTabs[$name_single] )) { $html = array(); foreach ($this->customTabs[$name_single] as $customTab) { - if (ComponentbuilderHelper::checkArray($customTab) + if (ArrayHelper::check($customTab) && isset($customTab['html'])) { if ($customTab['tab'] == $nr && $customTab['position'] == $target && isset($customTab['html']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $customTab['html'] )) { @@ -13576,7 +13601,7 @@ class Interpretation extends Fields } } // return if found - if (ComponentbuilderHelper::checkArray($html)) + if (ArrayHelper::check($html)) { return PHP_EOL . implode(PHP_EOL, $html); } @@ -13650,7 +13675,7 @@ class Interpretation extends Fields $target = array('site' => $nameSingleCode); $this->buildDynamique($target, $type, $layoutName); } - if (ComponentbuilderHelper::checkString($items)) + if (StringHelper::check($items)) { // LAYOUTITEMS <<>> $this->fileContentDynamic[$nameSingleCode . '_' @@ -13689,7 +13714,7 @@ class Interpretation extends Fields $this->buildDynamique($target, 'layoutoverride', $layoutName); } // make sure items is an empty string (should not be needed.. but) - if (!ComponentbuilderHelper::checkString($items)) + if (!StringHelper::check($items)) { $items = ''; } @@ -13698,7 +13723,7 @@ class Interpretation extends Fields $placeholder[$this->hhh . 'LAYOUTITEMS' . $this->hhh] = $items; // OVERRIDE_LAYOUT_CODE <<>> $php_view = (array) explode(PHP_EOL, $data['php_view']); - if (ComponentbuilderHelper::checkArray($php_view)) + if (ArrayHelper::check($php_view)) { $php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view); $this->fileContentDynamic[$nameSingleCode . '_' @@ -13879,8 +13904,8 @@ class Interpretation extends Fields break; } } - if (ComponentbuilderHelper::checkString($name_single_code) - && ComponentbuilderHelper::checkString($name_list_code)) + if (StringHelper::check($name_single_code) + && StringHelper::check($name_list_code)) { $head = $this->setListHeadLinked( $name_single_code, $name_list_code, $addNewButon, @@ -13889,7 +13914,7 @@ class Interpretation extends Fields $body = $this->setListBodyLinked( $name_single_code, $name_list_code, $nameSingleCode ); - $functionName = ComponentbuilderHelper::safeString($codeName, 'F'); + $functionName = StringHelper::safe($codeName, 'F'); // LAYOUTITEMSTABLE <<>> $this->fileContentDynamic[$nameSingleCode . '_' . $layoutCodeName][$this->hhh . 'LAYOUTITEMSTABLE' . $this->hhh] @@ -14010,7 +14035,7 @@ class Interpretation extends Fields } // LINKEDVIEWGLOBAL <<>> if (isset($parent_keys) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $parent_keys )) { @@ -14018,7 +14043,7 @@ class Interpretation extends Fields foreach ($parent_keys as $parent_key) { $globalKey[$parent_key] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $_key . $this->uniquekey(4) ); $this->fileContentDynamic[$nameSingleCode][$this->hhh @@ -14031,7 +14056,7 @@ class Interpretation extends Fields else { // set the global key - $globalKey = ComponentbuilderHelper::safeString( + $globalKey = StringHelper::safe( $_key . $this->uniquekey(4) ); $this->fileContentDynamic[$nameSingleCode][$this->hhh @@ -14202,7 +14227,7 @@ class Interpretation extends Fields ) { if (isset($this->listBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->listBuilder[$nameListCode] )) { @@ -14396,7 +14421,7 @@ class Interpretation extends Fields ) { if (isset($this->listBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->listBuilder[$nameListCode] )) { @@ -14417,7 +14442,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -14490,7 +14515,7 @@ class Interpretation extends Fields $head .= PHP_EOL . ""; // main lang prefix $langView = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString($nameSingleCode, 'U'); + . StringHelper::safe($nameSingleCode, 'U'); // set status lang $statusLangName = $langView . '_STATUS'; // set id lang @@ -14512,7 +14537,7 @@ class Interpretation extends Fields { // check if we have an over-ride if (isset($this->listHeadOverRide[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->listHeadOverRide[$nameListCode] ) && isset($this->listHeadOverRide[$nameListCode][$item['id']])) @@ -14603,7 +14628,7 @@ class Interpretation extends Fields { // check if this view has category added if (isset($this->categoryBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$nameListCode] )) { @@ -14662,7 +14687,7 @@ class Interpretation extends Fields ); // add the custom fields query $query .= $this->setCustomQuery($nameListCode, $nameSingleCode); - if (ComponentbuilderHelper::checkString($globalKey) && $key + if (StringHelper::check($globalKey) && $key && strpos( $key, '-R>' ) === false @@ -14709,7 +14734,7 @@ class Interpretation extends Fields $ORarray = array($key); } // make sure we have an array - if (!ComponentbuilderHelper::checkArray($globalKey)) + if (!ArrayHelper::check($globalKey)) { $globalKey = array($globalKey); } @@ -14752,7 +14777,7 @@ class Interpretation extends Fields } } if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] )) { @@ -14869,7 +14894,7 @@ class Interpretation extends Fields $this->_t(1) ); // filter by child repetable field values - if (ComponentbuilderHelper::checkString($globalKey) && $key + if (StringHelper::check($globalKey) && $key && strpos( $key, '-R>' ) !== false @@ -14916,7 +14941,7 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "}"; } // filter by child array field values - if (ComponentbuilderHelper::checkString($globalKey) && $key + if (StringHelper::check($globalKey) && $key && strpos( $key, '-R>' ) === false @@ -14936,7 +14961,7 @@ class Interpretation extends Fields . "foreach (\$items as \$nr => &\$item)"; $query .= PHP_EOL . $this->_t(4) . "{"; list($bin, $target) = explode('-A>', $key); - if (ComponentbuilderHelper::checkString($target)) + if (StringHelper::check($target)) { $query .= PHP_EOL . $this->_t(5) . "if (" . $this->fileContentStatic[$this->hhh . 'Component' @@ -14989,7 +15014,7 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "}"; } // filter by parent repetable field values - if (ComponentbuilderHelper::checkString($globalKey) && $key + if (StringHelper::check($globalKey) && $key && strpos( $parentKey, '-R>' ) !== false @@ -15037,7 +15062,7 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "}"; } // filter by parent array field values - if (ComponentbuilderHelper::checkString($globalKey) && $key + if (StringHelper::check($globalKey) && $key && strpos( $parentKey, '-R>' ) === false @@ -15058,7 +15083,7 @@ class Interpretation extends Fields . "foreach (\$items as \$nr => &\$item)"; $query .= PHP_EOL . $this->_t(4) . "{"; list($bin, $target) = explode('-A>', $parentKey); - if (ComponentbuilderHelper::checkString($target)) + if (StringHelper::check($target)) { $query .= PHP_EOL . $this->_t(5) . "if (\$item->" . $_key . " && " . $this->fileContentStatic[$this->hhh . 'Component' @@ -15126,7 +15151,7 @@ class Interpretation extends Fields { $buttons = ''; if (isset($this->customAdminDynamicButtons[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customAdminDynamicButtons[$nameListCode] )) { @@ -15139,7 +15164,7 @@ class Interpretation extends Fields // Load to lang $keyLang = $this->langPrefix . '_' . $custom_button['NAME']; $this->setLangContent( - $this->lang, $keyLang, ComponentbuilderHelper::safeString( + $this->lang, $keyLang, StringHelper::safe( $custom_button['name'], 'Ww' ) ); @@ -15151,13 +15176,13 @@ class Interpretation extends Fields . " add " . $custom_button['name'] . " button."; $buttons[] = $this->_t(3) . "JToolBarHelper::custom('" . $nameListCode . ".redirectTo" - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $custom_button['link'], 'F' ) . "', '" . $custom_button['icon'] . "', '', '" . $keyLang . "', true);"; $buttons[] = $this->_t(2) . "}"; } - if (ComponentbuilderHelper::checkArray($buttons)) + if (ArrayHelper::check($buttons)) { return implode(PHP_EOL, $buttons); } @@ -15175,7 +15200,7 @@ class Interpretation extends Fields { $method = ''; if (isset($this->customAdminDynamicButtons[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customAdminDynamicButtons[$nameListCode] )) { @@ -15188,7 +15213,7 @@ class Interpretation extends Fields // add the custom redirect method $method[] = PHP_EOL . PHP_EOL . $this->_t(1) . "public function redirectTo" - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $custom_button['link'], 'F' ) . "()"; $method[] = $this->_t(1) . "{"; @@ -15381,7 +15406,7 @@ class Interpretation extends Fields } // if values were returned add the area if (isset($custom_query) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $custom_query )) { @@ -15396,7 +15421,7 @@ class Interpretation extends Fields } // add access levels if the view has access set if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] )) { @@ -15473,7 +15498,7 @@ class Interpretation extends Fields } // add translations if (isset($query_translations) - && ComponentbuilderHelper::checkString($query_translations)) + && StringHelper::check($query_translations)) { $query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ @@ -15561,7 +15586,7 @@ class Interpretation extends Fields $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the model"; $method[] = $this->_t(3) . "\$model = \$this->getModel('" - . ComponentbuilderHelper::safeString($nameListCode, 'F') + . StringHelper::safe($nameListCode, 'F') . "');"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " get the data to export"; @@ -15576,11 +15601,11 @@ class Interpretation extends Fields $method[] = $this->_t(4) . "\$date = JFactory::getDate();"; $method[] = $this->_t(4) . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::xls(\$data,'" - . ComponentbuilderHelper::safeString($nameListCode, 'F') + . StringHelper::safe($nameListCode, 'F') . "_'.\$date->format('jS_F_Y'),'" - . ComponentbuilderHelper::safeString($nameListCode, 'Ww') + . StringHelper::safe($nameListCode, 'Ww') . " exported ('.\$date->format('jS F, Y').')','" - . ComponentbuilderHelper::safeString($nameListCode, 'w') + . StringHelper::safe($nameListCode, 'w') . "');"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(2) . "}"; @@ -15615,7 +15640,7 @@ class Interpretation extends Fields $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the import model"; $method[] = $this->_t(3) . "\$model = \$this->getModel('" - . ComponentbuilderHelper::safeString($nameListCode, 'F') + . StringHelper::safe($nameListCode, 'F') . "');"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " get the headers to import"; @@ -15641,7 +15666,7 @@ class Interpretation extends Fields // add to lang array $selectImportFileNote = $this->langPrefix . "_IMPORT_SELECT_FILE_FOR_" - . ComponentbuilderHelper::safeString($nameListCode, 'U'); + . StringHelper::safe($nameListCode, 'U'); $this->setLangContent( $this->lang, $selectImportFileNote, 'Select the file to import data to ' . $nameListCode . '.' @@ -15692,7 +15717,7 @@ class Interpretation extends Fields { // main lang prefix $langExport = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Export Data', 'U'); + . StringHelper::safe('Export Data', 'U'); // add to lang array $this->setLangContent($this->lang, $langExport, 'Export Data'); $button = array(); @@ -15719,7 +15744,7 @@ class Interpretation extends Fields { // main lang prefix $langImport = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Import Data', 'U'); + . StringHelper::safe('Import Data', 'U'); // add to lang array $this->setLangContent($this->lang, $langImport, 'Import Data'); $button = array(); @@ -15823,7 +15848,7 @@ class Interpretation extends Fields { // check if this view has category added if (isset($this->categoryBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$nameListCode] )) { @@ -15889,7 +15914,7 @@ class Interpretation extends Fields . "\$query->where('(a.published = 0 OR a.published = 1)');"; $query .= PHP_EOL . $this->_t(2) . "}"; if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] )) { @@ -16063,7 +16088,7 @@ class Interpretation extends Fields public function setSearchQuery($nameListCode) { if (isset($this->searchBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->searchBuilder[$nameListCode] )) { @@ -16075,7 +16100,7 @@ class Interpretation extends Fields if ($nr == 0) { $search .= "a." . $array['code'] . " LIKE '.\$search.'"; - if (ComponentbuilderHelper::checkArray($array['custom']) + if (ArrayHelper::check($array['custom']) && 1 == $array['list']) { $search .= " OR " . $array['custom']['db'] . "." @@ -16085,7 +16110,7 @@ class Interpretation extends Fields else { $search .= " OR a." . $array['code'] . " LIKE '.\$search.'"; - if (ComponentbuilderHelper::checkArray($array['custom']) + if (ArrayHelper::check($array['custom']) && 1 == $array['list']) { $search .= " OR " . $array['custom']['db'] . "." @@ -16129,7 +16154,7 @@ class Interpretation extends Fields ) { if (isset($this->customBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customBuilder[$nameListCode] )) { @@ -16138,7 +16163,7 @@ class Interpretation extends Fields { // only load this if table is set if ((isset($this->customBuilderList[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customBuilderList[$nameListCode] ) && in_array( @@ -16146,20 +16171,20 @@ class Interpretation extends Fields $this->customBuilderList[$nameListCode] ) && isset($filter['custom']['table']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $filter['custom']['table'] ) && $filter['method'] == 0) || ($just_text && isset($filter['custom']['table']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $filter['custom']['table'] ) && $filter['method'] == 0)) { $query .= PHP_EOL . PHP_EOL . $this->_t(2) . $tab . "//" . $this->setLine(__LINE__) . " From the " - . ComponentbuilderHelper::safeString( - ComponentbuilderHelper::safeString( + . StringHelper::safe( + StringHelper::safe( $filter['custom']['table'], 'w' ) ) . " table."; @@ -16211,7 +16236,7 @@ class Interpretation extends Fields public function setFilterQuery($nameListCode) { if (isset($this->filterBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->filterBuilder[$nameListCode] )) { @@ -16385,7 +16410,7 @@ class Interpretation extends Fields $nameSingleCode = $viewArray['settings']->name_single_code; // add conditions to this view if (isset($viewArray['settings']->conditions) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $viewArray['settings']->conditions )) { @@ -16398,7 +16423,7 @@ class Interpretation extends Fields foreach ($viewArray['settings']->conditions as $condition) { if (isset($condition['match_name']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $condition['match_name'] )) { @@ -16420,7 +16445,7 @@ class Interpretation extends Fields $viewArray['settings']->conditions, $condition, $nameSingleCode ); - if (ComponentbuilderHelper::checkArray($relations)) + if (ArrayHelper::check($relations)) { // set behavior and default array $behaviors[$matchName] = $targetBehavior; @@ -16462,7 +16487,7 @@ class Interpretation extends Fields foreach ($relations as $relation) { - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $relation['match_name'] )) { @@ -16543,7 +16568,7 @@ class Interpretation extends Fields $validation = ''; $isSet = ''; $listener = ''; - if (ComponentbuilderHelper::checkArray($functions)) + if (ArrayHelper::check($functions)) { // now build the initial script $initial .= "//" . $this->setLine(__LINE__) . " Initial Script" @@ -16572,7 +16597,7 @@ class Interpretation extends Fields ); if (isset($this->setScriptMediaSwitch) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->setScriptMediaSwitch ) && in_array( @@ -16584,7 +16609,7 @@ class Interpretation extends Fields else { if (isset($this->setScriptUserSwitch) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->setScriptUserSwitch ) && in_array( @@ -16614,7 +16639,7 @@ class Interpretation extends Fields } } } - if (ComponentbuilderHelper::checkString($modal)) + if (StringHelper::check($modal)) { $listener .= PHP_EOL . "window.SqueezeBox.initialize({"; $listener .= PHP_EOL . $this->_t(1) . "onClose:function(){"; @@ -16645,7 +16670,7 @@ class Interpretation extends Fields $fucounter = 0; foreach ($f_matchKeys as $fu_matchKey) { - if (ComponentbuilderHelper::checkString($fu_matchKey)) + if (StringHelper::check($fu_matchKey)) { if ($fucounter == 0) { @@ -16696,7 +16721,7 @@ class Interpretation extends Fields . " set the function logic"; $map .= PHP_EOL . $this->_t(1) . "if ("; $if = $ifValue[$a_matchKey]; - if (ComponentbuilderHelper::checkString($if)) + if (StringHelper::check($if)) { $map .= $if; } @@ -16739,7 +16764,7 @@ class Interpretation extends Fields foreach ($f_matchKeys as $f_matchKey) { $if = $ifValue[$f_matchKey]; - if (ComponentbuilderHelper::checkString($if)) + if (StringHelper::check($if)) { if ($ifcounter == 0) { @@ -16763,7 +16788,7 @@ class Interpretation extends Fields foreach ($controls as $target => $action) { $func .= $action['behavior']; - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $action[$targetBehavior] )) { @@ -16781,7 +16806,7 @@ class Interpretation extends Fields foreach ($controls as $target => $action) { $func .= $action['default']; - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $action[$targetDefault] )) { @@ -16794,7 +16819,7 @@ class Interpretation extends Fields } // add the needed validation to file if (isset($this->validationFixBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->validationFixBuilder[$nameSingleCode] )) { @@ -16880,7 +16905,7 @@ class Interpretation extends Fields ); // add custom script to footer if (isset($this->customScriptBuilder['view_footer'][$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->customScriptBuilder['view_footer'][$nameSingleCode] )) { @@ -16906,7 +16931,7 @@ class Interpretation extends Fields 'views_file', $nameSingleCode, PHP_EOL . PHP_EOL, null, true, false )) !== false - && ComponentbuilderHelper::checkString($list_fileScript)) + && StringHelper::check($list_fileScript)) { // get dates $_created = $this->getCreatedDate($viewArray); @@ -16940,7 +16965,7 @@ class Interpretation extends Fields } // minfy the script if ($this->minify && isset($list_fileScript) - && ComponentbuilderHelper::checkString($list_fileScript)) + && StringHelper::check($list_fileScript)) { // minify the fielScript javscript $minifier = new JS; @@ -16949,7 +16974,7 @@ class Interpretation extends Fields } // minfy the script if ($this->minify && isset($fileScript) - && ComponentbuilderHelper::checkString($fileScript)) + && StringHelper::check($fileScript)) { // minify the fielScript javscript $minifier = new JS; @@ -16958,7 +16983,7 @@ class Interpretation extends Fields } // minfy the script if ($this->minify && isset($footerScript) - && ComponentbuilderHelper::checkString($footerScript)) + && StringHelper::check($footerScript)) { // minify the footerScript javscript $minifier = new JS; @@ -16967,7 +16992,7 @@ class Interpretation extends Fields } // make sure there is script to add if (isset($list_fileScript) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $list_fileScript )) { @@ -16977,12 +17002,12 @@ class Interpretation extends Fields } // make sure there is script to add if (isset($fileScript) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $fileScript )) { // add the head script if set - if (isset($head) && ComponentbuilderHelper::checkString($head)) + if (isset($head) && StringHelper::check($head)) { $fileScript = "// Some Global Values" . PHP_EOL . $head . PHP_EOL . $fileScript; @@ -16993,7 +17018,7 @@ class Interpretation extends Fields } // make sure to add custom footer script if php was found in it, since we canot minfy it with php if (isset($customFooterScript) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $customFooterScript )) { @@ -17005,7 +17030,7 @@ class Interpretation extends Fields } // make sure there is script to add if (isset($footerScript) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $footerScript )) { @@ -17040,7 +17065,7 @@ class Interpretation extends Fields } // make sure that the function is loaded only once - if (ComponentbuilderHelper::checkArray($funcsets)) + if (ArrayHelper::check($funcsets)) { $initial .= PHP_EOL . $this->_t(1) . $function . "("; $initial .= implode(',', $funcsets); @@ -17057,7 +17082,7 @@ class Interpretation extends Fields // convert to name array foreach ($condition['target_field'] as $targetField) { - if (ComponentbuilderHelper::checkArray($targetField) + if (ArrayHelper::check($targetField) && isset($targetField['name'])) { $currentTargets[] = $targetField['name']; @@ -17072,13 +17097,13 @@ class Interpretation extends Fields if ($relation['match_field'] !== $condition['match_field'] && $relation['target_relation']) // Made this change to see if it improves the expected result (TODO) { - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $relation['target_field'] )) { foreach ($relation['target_field'] as $target) { - if (ComponentbuilderHelper::checkArray($target) + if (ArrayHelper::check($target) && $this->checkRelationControl( $target['name'], $relation['match_name'], $condition['match_name'], $view @@ -17110,12 +17135,12 @@ class Interpretation extends Fields ) { if (isset($this->targetRelationControl[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->targetRelationControl[$view] )) { if (isset($this->targetRelationControl[$view][$targetName]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->targetRelationControl[$view][$targetName] )) { @@ -17137,7 +17162,7 @@ class Interpretation extends Fields } } elseif (!isset($this->targetRelationControl[$view]) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->targetRelationControl[$view] )) { @@ -17152,14 +17177,14 @@ class Interpretation extends Fields ) { $bucket = array(); - if (ComponentbuilderHelper::checkArray($targets) + if (ArrayHelper::check($targets) && !in_array( $uniqueVar, $this->targetControlsScriptChecker )) { foreach ($targets as $target) { - if (ComponentbuilderHelper::checkArray($target)) + if (ArrayHelper::check($target)) { // set the required var if ($target['required'] === 'yes') @@ -17350,7 +17375,7 @@ class Interpretation extends Fields || ComponentbuilderHelper::fieldCheck($type, 'dynamic') || !ComponentbuilderHelper::fieldCheck($type)) { - if (ComponentbuilderHelper::checkArray($options)) + if (ArrayHelper::check($options)) { foreach ($options as $option) { @@ -17361,7 +17386,7 @@ class Interpretation extends Fields $option = "'" . $option . "'"; } } - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { $string .= ' || ' . $value . ' == ' . $option; } @@ -17383,7 +17408,7 @@ class Interpretation extends Fields || ComponentbuilderHelper::fieldCheck($type, 'dynamic') || !ComponentbuilderHelper::fieldCheck($type)) { - if (ComponentbuilderHelper::checkArray($options)) + if (ArrayHelper::check($options)) { foreach ($options as $option) { @@ -17394,7 +17419,7 @@ class Interpretation extends Fields $option = "'" . $option . "'"; } } - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { $string .= ' || ' . $value . ' != ' . $option; } @@ -17416,7 +17441,7 @@ class Interpretation extends Fields || ComponentbuilderHelper::fieldCheck($type, 'dynamic') || !ComponentbuilderHelper::fieldCheck($type)) { - if (ComponentbuilderHelper::checkArray($options)) + if (ArrayHelper::check($options)) { foreach ($options as $option) { @@ -17427,7 +17452,7 @@ class Interpretation extends Fields $option = "'" . $option . "'"; } } - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { $string .= ' || ' . $value . ' == ' . $option; } @@ -17441,7 +17466,7 @@ class Interpretation extends Fields { $userFix = ''; if (isset($this->setScriptUserSwitch) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->setScriptUserSwitch ) && in_array($type, $this->setScriptUserSwitch)) @@ -17471,13 +17496,13 @@ class Interpretation extends Fields // only 4 text_field if (ComponentbuilderHelper::fieldCheck($type, 'text')) { - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $options['keywords'] )) { foreach ($options['keywords'] as $keyword) { - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { $string .= ' && ' . $value . '.indexOf("' . $keyword . '") >= 0'; @@ -17489,7 +17514,7 @@ class Interpretation extends Fields } } } - if (!ComponentbuilderHelper::checkString($string)) + if (!StringHelper::check($string)) { $string .= $value . ' == "error"'; } @@ -17499,13 +17524,13 @@ class Interpretation extends Fields // only 4 text_field if (ComponentbuilderHelper::fieldCheck($type, 'text')) { - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $options['keywords'] )) { foreach ($options['keywords'] as $keyword) { - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { $string .= ' || ' . $value . '.indexOf("' . $keyword . '") >= 0'; @@ -17517,7 +17542,7 @@ class Interpretation extends Fields } } } - if (!ComponentbuilderHelper::checkString($string)) + if (!StringHelper::check($string)) { $string .= $value . ' == "error"'; } @@ -17527,16 +17552,16 @@ class Interpretation extends Fields // only 4 text_field if (ComponentbuilderHelper::fieldCheck($type, 'text')) { - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $options['keywords'] )) { foreach ($options['keywords'] as $keyword) { - $keyword = ComponentbuilderHelper::safeString( + $keyword = StringHelper::safe( $keyword, 'w' ); - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { $string .= ' && ' . $value . '.toLowerCase().indexOf("' . $keyword @@ -17549,7 +17574,7 @@ class Interpretation extends Fields } } } - if (!ComponentbuilderHelper::checkString($string)) + if (!StringHelper::check($string)) { $string .= $value . ' == "error"'; } @@ -17559,16 +17584,16 @@ class Interpretation extends Fields // only 4 text_field if (ComponentbuilderHelper::fieldCheck($type, 'text')) { - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $options['keywords'] )) { foreach ($options['keywords'] as $keyword) { - $keyword = ComponentbuilderHelper::safeString( + $keyword = StringHelper::safe( $keyword, 'w' ); - if (ComponentbuilderHelper::checkString($string)) + if (StringHelper::check($string)) { $string .= ' || ' . $value . '.toLowerCase().indexOf("' . $keyword @@ -17581,7 +17606,7 @@ class Interpretation extends Fields } } } - if (!ComponentbuilderHelper::checkString($string)) + if (!StringHelper::check($string)) { $string .= $value . ' == "error"'; } @@ -17591,7 +17616,7 @@ class Interpretation extends Fields // only 4 text_field if (ComponentbuilderHelper::fieldCheck($type, 'text')) { - if (ComponentbuilderHelper::checkArray($options)) + if (ArrayHelper::check($options)) { if ($options['length']) { @@ -17599,7 +17624,7 @@ class Interpretation extends Fields . (int) $options['length']; } } - if (!ComponentbuilderHelper::checkString($string)) + if (!StringHelper::check($string)) { $string .= $value . '.length >= 5'; } @@ -17609,7 +17634,7 @@ class Interpretation extends Fields // only 4 text_field if (ComponentbuilderHelper::fieldCheck($type, 'text')) { - if (ComponentbuilderHelper::checkArray($options)) + if (ArrayHelper::check($options)) { if ($options['length']) { @@ -17617,7 +17642,7 @@ class Interpretation extends Fields . (int) $options['length']; } } - if (!ComponentbuilderHelper::checkString($string)) + if (!StringHelper::check($string)) { $string .= $value . '.length <= 5'; } @@ -17627,7 +17652,7 @@ class Interpretation extends Fields // only 4 text_field if (ComponentbuilderHelper::fieldCheck($type, 'text')) { - if (ComponentbuilderHelper::checkArray($options)) + if (ArrayHelper::check($options)) { if ($options['length']) { @@ -17635,14 +17660,14 @@ class Interpretation extends Fields . (int) $options['length']; } } - if (!ComponentbuilderHelper::checkString($string)) + if (!StringHelper::check($string)) { $string .= $value . '.length == 5'; } } break; } - if (!ComponentbuilderHelper::checkString($string)) + if (!StringHelper::check($string)) { $string = 0; } @@ -17653,7 +17678,7 @@ class Interpretation extends Fields public function getOptionsScript($type, $options) { $buket = array(); - if (ComponentbuilderHelper::checkString($options)) + if (StringHelper::check($options)) { if (ComponentbuilderHelper::fieldCheck($type, 'list') || ComponentbuilderHelper::fieldCheck($type, 'dynamic') @@ -17662,7 +17687,7 @@ class Interpretation extends Fields $optionsArray = array_map( 'trim', (array) explode(PHP_EOL, $options) ); - if (!ComponentbuilderHelper::checkArray($optionsArray)) + if (!ArrayHelper::check($optionsArray)) { $optionsArray[] = $optionsArray; } @@ -17684,10 +17709,10 @@ class Interpretation extends Fields elseif (ComponentbuilderHelper::fieldCheck($type, 'text')) { // check to get the key words if set - $keywords = ComponentbuilderHelper::getBetween( + $keywords = GetHelper::between( $options, 'keywords="', '"' ); - if (ComponentbuilderHelper::checkString($keywords)) + if (StringHelper::check($keywords)) { if (strpos($keywords, ',') !== false) { @@ -17705,10 +17730,10 @@ class Interpretation extends Fields } } // check to ket string length if set - $length = ComponentbuilderHelper::getBetween( + $length = GetHelper::between( $options, 'length="', '"' ); - if (ComponentbuilderHelper::checkString($length)) + if (StringHelper::check($length)) { $buket['length'] = $length; } @@ -17750,7 +17775,7 @@ class Interpretation extends Fields . ' input[type=\'radio\']:checked").val();'; } elseif (isset($this->setScriptUserSwitch) - && ComponentbuilderHelper::checkArray($this->setScriptUserSwitch) + && ArrayHelper::check($this->setScriptUserSwitch) && in_array($type, $this->setScriptUserSwitch)) { // this is only since 3.3.4 @@ -17813,7 +17838,7 @@ class Interpretation extends Fields { $fix = ''; if (isset($this->validationFixBuilder[$view]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->validationFixBuilder[$view] )) { @@ -17895,7 +17920,7 @@ class Interpretation extends Fields { $tasks = ''; if (isset($this->customScriptBuilder[$target]['ajax_controller']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customScriptBuilder[$target]['ajax_controller'] )) { @@ -17909,7 +17934,7 @@ class Interpretation extends Fields $taskArray[$task['task_name']] = $task['task_name']; } } - if (ComponentbuilderHelper::checkArray($taskArray)) + if (ArrayHelper::check($taskArray)) { foreach ($taskArray as $name) { @@ -17926,7 +17951,7 @@ class Interpretation extends Fields { $cases = ''; if (isset($this->customScriptBuilder[$target]['ajax_controller']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customScriptBuilder[$target]['ajax_controller'] )) { @@ -17970,7 +17995,7 @@ class Interpretation extends Fields } } } - if (ComponentbuilderHelper::checkArray($getModel)) + if (ArrayHelper::check($getModel)) { foreach ($getModel as $task => $getMethod) { @@ -17990,7 +18015,7 @@ class Interpretation extends Fields ); // check if we have some values to check if (isset($ifArray[$task]) - && ComponentbuilderHelper::checkArray($ifArray[$task])) + && ArrayHelper::check($ifArray[$task])) { // set if string $ifvalues = implode(' && ', $ifArray[$task]); @@ -18059,7 +18084,7 @@ class Interpretation extends Fields { $methods = ''; if (isset($this->customScriptBuilder[$target]['ajax_model']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customScriptBuilder[$target]['ajax_model'] )) { @@ -18092,7 +18117,7 @@ class Interpretation extends Fields { // the old filter type uses these functions if (isset($this->filterBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->filterBuilder[$nameListCode] )) { @@ -18110,7 +18135,7 @@ class Interpretation extends Fields foreach ($this->filterBuilder[$nameListCode] as $filter) { if ($filter['type'] != 'category' - && ComponentbuilderHelper::checkArray($filter['custom']) + && ArrayHelper::check($filter['custom']) && $filter['custom']['extends'] === 'user') { // add if this is a function path @@ -18118,7 +18143,7 @@ class Interpretation extends Fields { $function[] = PHP_EOL . $this->_t(1) . "protected function getThe" . $filter['function'] - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $filter['custom']['text'], 'F' ) . "Selections()"; $function[] = $this->_t(1) . "{"; @@ -18189,7 +18214,7 @@ class Interpretation extends Fields /* else { - $function[] = PHP_EOL.$this->_t(1) . "protected function getThe".$filter['function'].ComponentbuilderHelper::safeString($filter['custom']['text'],'F')."Selections()"; + $function[] = PHP_EOL.$this->_t(1) . "protected function getThe".$filter['function'].StringHelper::safe($filter['custom']['text'],'F')."Selections()"; $function[] = $this->_t(1) . "{"; $function[] = $this->_t(2) . "//".$this->setLine(__LINE__)." Get a db connection."; $function[] = $this->_t(2) . "\$db = JFactory::getDbo();"; @@ -18227,11 +18252,11 @@ class Interpretation extends Fields } */ } elseif ($filter['type'] != 'category' - && !ComponentbuilderHelper::checkArray($filter['custom'])) + && !ArrayHelper::check($filter['custom'])) { $translation = false; if (isset($this->selectionTranslationFixBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->selectionTranslationFixBuilder[$nameListCode] ) && array_key_exists( @@ -18420,7 +18445,7 @@ class Interpretation extends Fields // and give a notice that this will cause an issue elseif (!$funtion_path && $filter['type'] != 'category' && $filter['multi'] == 2 - && ComponentbuilderHelper::checkArray($filter['custom'])) + && ArrayHelper::check($filter['custom'])) { // get the field code $field_code = $this->getCustomFieldCode( @@ -18457,7 +18482,7 @@ class Interpretation extends Fields } // divert the code to a file if this is not a funtion path if (!$funtion_path - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $function )) { @@ -18470,7 +18495,7 @@ class Interpretation extends Fields } } // if this is a function path, return the function if set - if ($funtion_path && ComponentbuilderHelper::checkArray($function)) + if ($funtion_path && ArrayHelper::check($function)) { // return the function return PHP_EOL . implode(PHP_EOL, $function); @@ -18495,7 +18520,7 @@ class Interpretation extends Fields $fields[] = $this->_t(1) . "protected function getUniqueFields()"; $fields[] = $this->_t(1) . "{"; if (isset($this->dbUniqueKeys[$view]) - && ComponentbuilderHelper::checkArray($this->dbUniqueKeys[$view])) + && ArrayHelper::check($this->dbUniqueKeys[$view])) { // if guid should also be added if (isset($this->dbUniqueGuid[$view])) @@ -18551,7 +18576,7 @@ class Interpretation extends Fields if (isset($this->adminFilterType[$nameListCode]) && $this->adminFilterType[$nameListCode] == 1 && isset($this->filterBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->filterBuilder[$nameListCode] )) { @@ -18562,17 +18587,17 @@ class Interpretation extends Fields foreach ($this->filterBuilder[$nameListCode] as $filter) { if ($filter['type'] != 'category' - && ComponentbuilderHelper::checkArray($filter['custom']) + && ArrayHelper::check($filter['custom']) && $filter['custom']['extends'] !== 'user') { - $CodeName = ComponentbuilderHelper::safeString( + $CodeName = StringHelper::safe( $filter['code'] . ' ' . $filter['custom']['text'], 'W' ); $codeName = $filter['code'] - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $filter['custom']['text'], 'F' ); - $type = ComponentbuilderHelper::safeString( + $type = StringHelper::safe( $filter['custom']['type'], 'F' ); $fieldFilters[] = PHP_EOL . $this->_t(2) . "//" @@ -18625,15 +18650,15 @@ class Interpretation extends Fields } elseif ($filter['type'] != 'category') { - $Codename = ComponentbuilderHelper::safeString( + $Codename = StringHelper::safe( $filter['code'], 'W' ); if (isset($filter['custom']) - && ComponentbuilderHelper::checkArray($filter['custom']) + && ArrayHelper::check($filter['custom']) && $filter['custom']['extends'] === 'user') { $functionName = "\$this->getThe" . $filter['function'] - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $filter['custom']['text'], 'F' ) . "Selections();"; } @@ -18693,7 +18718,7 @@ class Interpretation extends Fields } } // did we find filters - if (ComponentbuilderHelper::checkArray($fieldFilters)) + if (ArrayHelper::check($fieldFilters)) { // return the filter return PHP_EOL . implode(PHP_EOL, $fieldFilters); @@ -18737,7 +18762,7 @@ class Interpretation extends Fields $filter[] = $this->_t(2) . "}"; // check if view has access if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] ) && !isset($this->fieldsNames[$nameSingleCode]['access'])) @@ -18768,7 +18793,7 @@ class Interpretation extends Fields if (isset($this->adminFilterType[$nameListCode]) && $this->adminFilterType[$nameListCode] == 1 && isset($this->categoryBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$nameListCode] ) && isset($this->categoryBuilder[$nameListCode]['extension']) @@ -18809,7 +18834,7 @@ class Interpretation extends Fields $this->setCategoryBatchHelper($fieldBatch, $nameListCode); // check if we have other batch options to add if (isset($this->filterBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->filterBuilder[$nameListCode] )) { @@ -18828,14 +18853,14 @@ class Interpretation extends Fields foreach ($this->filterBuilder[$nameListCode] as $filter) { if ($filter['type'] != 'category' - && ComponentbuilderHelper::checkArray($filter['custom']) + && ArrayHelper::check($filter['custom']) && $filter['custom']['extends'] !== 'user') { - $CodeName = ComponentbuilderHelper::safeString( + $CodeName = StringHelper::safe( $filter['code'] . ' ' . $filter['custom']['text'], 'W' ); $codeName = $filter['code'] - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $filter['custom']['text'], 'F' ); $fieldBatch[] = PHP_EOL . $this->_t(2) @@ -18848,7 +18873,7 @@ class Interpretation extends Fields // add the get values here if ($get_values) { - $type = ComponentbuilderHelper::safeString( + $type = StringHelper::safe( $filter['custom']['type'], 'F' ); $fieldBatch[] = $this->_t(3) . "//" @@ -18893,7 +18918,7 @@ class Interpretation extends Fields } elseif ($filter['type'] != 'category') { - $CodeName = ComponentbuilderHelper::safeString( + $CodeName = StringHelper::safe( $filter['code'], 'W' ); @@ -18950,7 +18975,7 @@ class Interpretation extends Fields } } // did we find batch options - if (ComponentbuilderHelper::checkArray($fieldBatch)) + if (ArrayHelper::check($fieldBatch)) { // return the batch return PHP_EOL . implode(PHP_EOL, $fieldBatch); @@ -18971,7 +18996,7 @@ class Interpretation extends Fields protected function setDefaultBatchHelper(&$batch, &$nameSingleCode) { // set component name - $COPMONENT = ComponentbuilderHelper::safeString( + $COPMONENT = StringHelper::safe( $this->componentData->name_code, 'U' ); // set batch @@ -18991,7 +19016,7 @@ class Interpretation extends Fields $batch[] = $this->_t(2) . "}"; // check if view has access if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] ) && !isset($this->fieldsNames[$nameSingleCode]['access'])) @@ -19025,13 +19050,13 @@ class Interpretation extends Fields protected function setCategoryBatchHelper(&$batch, &$nameListCode) { if (isset($this->categoryBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$nameListCode] ) && isset($this->categoryBuilder[$nameListCode]['extension'])) { // set component name - $COPMONENT = ComponentbuilderHelper::safeString( + $COPMONENT = StringHelper::safe( $this->componentData->name_code, 'U' ); // set filter @@ -19056,7 +19081,7 @@ class Interpretation extends Fields public function setRouterCategoryViews($nameSingleCode, $nameListCode) { if (isset($this->categoryBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$nameListCode] )) { @@ -19064,7 +19089,7 @@ class Interpretation extends Fields $_extension = $this->categoryBuilder[$nameListCode]['extension']; $_extension = explode('.', $_extension); // set component name - if (ComponentbuilderHelper::checkArray($_extension)) + if (ArrayHelper::check($_extension)) { $component = str_replace('com_', '', $_extension[0]); } @@ -19074,7 +19099,7 @@ class Interpretation extends Fields } // check if category has another name if (isset($this->catOtherName[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->catOtherName[$nameListCode] )) { @@ -19137,7 +19162,7 @@ class Interpretation extends Fields $this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh] ) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh] )) @@ -19174,11 +19199,11 @@ class Interpretation extends Fields $coreLoad = true; } // check if item has category - if (0) //isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameListCode])) <-- remove category from check + if (0) //isset($this->categoryBuilder[$nameListCode]) && ArrayHelper::check($this->categoryBuilder[$nameListCode])) <-- remove category from check { // check if category has another name if ($coreLoad && isset($this->catOtherName[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->catOtherName[$nameListCode] )) { @@ -19197,7 +19222,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.access']] ) && in_array( @@ -19231,7 +19256,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -19266,7 +19291,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.access']] ) && in_array( @@ -19288,7 +19313,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -19331,13 +19356,13 @@ class Interpretation extends Fields $coreLoad = true; } if (isset($this->categoryBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$nameListCode] )) { // check if category has another name if ($coreLoad && isset($this->catOtherName[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->catOtherName[$nameListCode] )) { @@ -19362,7 +19387,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.access']] ) && in_array( @@ -19390,7 +19415,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit']] ) && in_array( @@ -19412,7 +19437,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.own']) && isset($this->permissionBuilder[$core['core.edit.own']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.own']] ) && in_array( @@ -19453,7 +19478,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.own']) && isset($this->permissionBuilder['global'][$core['core.edit.own']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit.own']] ) && in_array( @@ -19490,7 +19515,7 @@ class Interpretation extends Fields $allow[] = $this->_t(2) . "}"; if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -19526,7 +19551,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder[$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.access']] ) && in_array( @@ -19554,7 +19579,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit']] ) && in_array( @@ -19578,7 +19603,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.own']) && isset($this->permissionBuilder[$core['core.edit.own']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.own']] ) && in_array( @@ -19621,7 +19646,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.own']) && isset($this->permissionBuilder['global'][$core['core.edit.own']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit.own']] ) && in_array( @@ -19648,7 +19673,7 @@ class Interpretation extends Fields $allow[] = $this->_t(2) . "}"; if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -19724,11 +19749,11 @@ class Interpretation extends Fields $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } - if (0) //isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameListCode])) <-- remove category from check + if (0) //isset($this->categoryBuilder[$nameListCode]) && ArrayHelper::check($this->categoryBuilder[$nameListCode])) <-- remove category from check { // check if category has another name if ($coreLoad && isset($this->catOtherName[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->catOtherName[$nameListCode] )) { @@ -19805,7 +19830,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder[$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.state']] ) && in_array( @@ -19885,7 +19910,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder[$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.state']] ) && in_array( @@ -19941,7 +19966,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.created_by']) && isset($this->permissionBuilder[$core['core.edit.created_by']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.created_by']] ) && in_array( @@ -19981,7 +20006,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.created']) && isset($this->permissionBuilder[$core['core.edit.created']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.created']] ) && in_array( @@ -20014,7 +20039,7 @@ class Interpretation extends Fields // check if the item has access permissions. if ($coreLoad && isset($core['core.edit.access']) && isset($this->permissionBuilder[$core['core.edit.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.access']] ) && in_array( @@ -20042,7 +20067,7 @@ class Interpretation extends Fields } // handel the fields permissions if (isset($this->permissionFields[$nameSingleCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionFields[$nameSingleCode] )) { @@ -20131,7 +20156,7 @@ class Interpretation extends Fields { $allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Modify the form based on Edit " - . ComponentbuilderHelper::safeString($fieldName, 'W') + . StringHelper::safe($fieldName, 'W') . " access controls."; $allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $nameSingleCode . ".edit." . $fieldName . "', 'com_" @@ -20182,7 +20207,7 @@ class Interpretation extends Fields { $allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Modify the from the form based on " - . ComponentbuilderHelper::safeString($fieldName, 'W') + . StringHelper::safe($fieldName, 'W') . " access controls."; $allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $nameSingleCode . ".access." . $fieldName . "', 'com_" @@ -20205,7 +20230,7 @@ class Interpretation extends Fields { $allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Modify the form based on View " - . ComponentbuilderHelper::safeString($fieldName, 'W') + . StringHelper::safe($fieldName, 'W') . " access controls."; $allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $nameSingleCode . ".view." . $fieldName . "', 'com_" @@ -20224,7 +20249,7 @@ class Interpretation extends Fields { $allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Modify the form based on View " - . ComponentbuilderHelper::safeString($fieldName, 'W') + . StringHelper::safe($fieldName, 'W') . " access controls."; $allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $nameSingleCode . ".view." . $fieldName . "', 'com_" @@ -20292,7 +20317,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder[$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit']] ) && in_array( @@ -20314,7 +20339,7 @@ class Interpretation extends Fields { $allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Check specific edit permission then general edit permission."; - if (ComponentbuilderHelper::checkString($customAllow)) + if (StringHelper::check($customAllow)) { $allow[] = $this->_t(2) . "\$user = JFactory::getUser();"; } @@ -20341,11 +20366,11 @@ class Interpretation extends Fields $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } - if (0) //isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameListCode])) <-- remove category from check + if (0) //isset($this->categoryBuilder[$nameListCode]) && ArrayHelper::check($this->categoryBuilder[$nameListCode])) <-- remove category from check { // check if category has another name if ($coreLoad && isset($this->catOtherName[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->catOtherName[$nameListCode] )) { @@ -20372,7 +20397,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($this->permissionBuilder[$core['core.delete']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.delete']] ) && in_array( @@ -20417,7 +20442,7 @@ class Interpretation extends Fields if ($coreLoad && (isset($core['core.delete']) && isset($this->permissionBuilder[$core['core.delete']])) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.delete']] ) && in_array( @@ -20465,11 +20490,11 @@ class Interpretation extends Fields $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } - if (0) // isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameListCode])) <-- remove category from check + if (0) // isset($this->categoryBuilder[$nameListCode]) && ArrayHelper::check($this->categoryBuilder[$nameListCode])) <-- remove category from check { // check if category has another name if (isset($this->catOtherName[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->catOtherName[$nameListCode] )) { @@ -20491,7 +20516,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder[$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.state']] ) && in_array( @@ -20533,7 +20558,7 @@ class Interpretation extends Fields $allow[] = $this->_t(2) . "}"; if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder[$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.state']] ) && in_array( @@ -20568,7 +20593,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder[$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.edit.state']] ) && in_array( @@ -20595,7 +20620,7 @@ class Interpretation extends Fields $allow[] = $this->_t(2) . "}"; if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( @@ -20636,7 +20661,7 @@ class Interpretation extends Fields // check if the item has permissions for edit. if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -20656,7 +20681,7 @@ class Interpretation extends Fields // check if the item has permissions for edit state. if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder['global'][$core['core.edit.state']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( @@ -20675,7 +20700,7 @@ class Interpretation extends Fields // check if the item has permissions for create. if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -20694,7 +20719,7 @@ class Interpretation extends Fields // check if the item has permissions for delete. if ($coreLoad && isset($core['core.delete']) && isset($this->permissionBuilder['global'][$core['core.delete']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.delete']] ) && in_array( @@ -20713,7 +20738,7 @@ class Interpretation extends Fields // check if the item has permissions for batch. if ($coreLoad && isset($core['core.batch']) && isset($this->permissionBuilder['global']['global'][$core['core.batch']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global']['global'][$core['core.batch']] ) && in_array( @@ -20797,7 +20822,7 @@ class Interpretation extends Fields $fields = "'a.id','id'"; $fields .= "," . PHP_EOL . $this->_t(4) . "'a.published','published'"; if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] )) { @@ -20810,7 +20835,7 @@ class Interpretation extends Fields // add the rest of the set filters if (isset($this->filterBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->filterBuilder[$nameListCode] )) { @@ -20827,7 +20852,7 @@ class Interpretation extends Fields } // add the rest of the set filters if (isset($this->sortBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->sortBuilder[$nameListCode] )) { @@ -20873,15 +20898,15 @@ class Interpretation extends Fields else { // check if custom field is set - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $filter['custom'] ) && isset($filter['custom']['db']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $filter['custom']['db'] ) && isset($filter['custom']['text']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $filter['custom']['text'] )) { @@ -20932,7 +20957,7 @@ class Interpretation extends Fields } // add if view calls for it, and not already added if (isset($this->accessBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->accessBuilder[$nameSingleCode] ) && !isset($this->fieldsNames[$nameSingleCode]['access'])) @@ -20967,7 +20992,7 @@ class Interpretation extends Fields } // add the rest of the set filters if (isset($this->filterBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->filterBuilder[$nameListCode] )) { @@ -20984,7 +21009,7 @@ class Interpretation extends Fields } // add the rest of the set filters if (isset($this->sortBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->sortBuilder[$nameListCode] )) { @@ -21131,7 +21156,7 @@ class Interpretation extends Fields { // set lang strings $viewNameLang_readonly = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $view['settings']->name_single . ' readonly', 'U' ); // load to lang @@ -21153,11 +21178,11 @@ class Interpretation extends Fields { // set lang strings $viewNameLang_new = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $view['settings']->name_single . ' New', 'U' ); $viewNameLang_edit = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $view['settings']->name_single . ' Edit', 'U' ); // load to lang @@ -21189,7 +21214,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(2) . "{"; if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -21213,7 +21238,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(3) . "}"; if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -21259,7 +21284,7 @@ class Interpretation extends Fields . " For new records, check the create permission."; if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -21291,7 +21316,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(3) . "{"; if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -21320,7 +21345,7 @@ class Interpretation extends Fields . " if we can return to make a new one."; if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -21344,7 +21369,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(4) . "}"; if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( @@ -21353,7 +21378,7 @@ class Interpretation extends Fields )) { if ($coreLoad && isset($this->historyBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->historyBuilder[$nameSingleCode] )) { @@ -21374,7 +21399,7 @@ class Interpretation extends Fields else { if ($coreLoad && isset($this->historyBuilder[$nameSingleCode]) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->historyBuilder[$nameSingleCode] )) { @@ -21393,7 +21418,7 @@ class Interpretation extends Fields } if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.create']] ) && in_array( @@ -21423,16 +21448,16 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(2) . "JToolbarHelper::divider();"; $toolBar .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " set help url for this view if found"; - $toolBar .= PHP_EOL . $this->_t(2) . "\$help_url = " + $toolBar .= PHP_EOL . $this->_t(2) . "\$this->help_url = " . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::getHelpUrl('" . $nameSingleCode . "');"; $toolBar .= PHP_EOL . $this->_t(2) . "if (" . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] . "Helper::checkString(\$help_url))"; + . $this->hhh] . "Helper::checkString(\$this->help_url))"; $toolBar .= PHP_EOL . $this->_t(2) . "{"; $toolBar .= PHP_EOL . $this->_t(3) . "JToolbarHelper::help('" - . $this->langPrefix . "_HELP_MANAGER', false, \$help_url);"; + . $this->langPrefix . "_HELP_MANAGER', false, \$this->help_url);"; $toolBar .= PHP_EOL . $this->_t(2) . "}"; } @@ -21469,7 +21494,7 @@ class Interpretation extends Fields $state .= $this->setDefaultPopulateState($nameSingleCode, $new_filter); // add the filters if (isset($this->filterBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->filterBuilder[$nameListCode] )) { @@ -21486,7 +21511,7 @@ class Interpretation extends Fields } // add the rest of the set filters if (isset($this->sortBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->sortBuilder[$nameListCode] )) { @@ -21641,7 +21666,7 @@ class Interpretation extends Fields // add the rest of the set filters if (isset($this->sortBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->sortBuilder[$nameListCode] )) { @@ -21655,7 +21680,7 @@ class Interpretation extends Fields . "'category_title' => JText:" . ":_('" . $filter['lang'] . "')"; } - elseif (ComponentbuilderHelper::checkArray( + elseif (ArrayHelper::check( $filter['custom'] )) { @@ -21684,7 +21709,7 @@ class Interpretation extends Fields public function setCheckinCall() { $call = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) - . " check in items"; + . " Check in items"; $call .= PHP_EOL . $this->_t(2) . "\$this->checkInNow();" . PHP_EOL; return $call; @@ -21713,22 +21738,28 @@ class Interpretation extends Fields ) . " Get a db connection."; $checkin .= PHP_EOL . $this->_t(3) . "\$db = JFactory::getDbo();"; $checkin .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) - . " reset query"; + . " Reset query."; $checkin .= PHP_EOL . $this->_t(3) . "\$query = \$db->getQuery(true);"; $checkin .= PHP_EOL . $this->_t(3) . "\$query->select('*');"; $checkin .= PHP_EOL . $this->_t(3) . "\$query->from(\$db->quoteName('#__" . $component . "_" . $view . "'));"; - $checkin .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; + $checkin .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) + . " Only select items that are checked out."; + $checkin .= PHP_EOL . $this->_t(3) + . "\$query->where(\$db->quoteName('checked_out') . '!=0');"; + $this->_t(3) . "//" . $this->setLine(__LINE__) + . " Query only to see if we have a rows"; + $checkin .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query, 0, 1);"; $checkin .= PHP_EOL . $this->_t(3) . "\$db->execute();"; $checkin .= PHP_EOL . $this->_t(3) . "if (\$db->getNumRows())"; $checkin .= PHP_EOL . $this->_t(3) . "{"; $checkin .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) - . " Get Yesterdays date"; + . " Get Yesterdays date."; $checkin .= PHP_EOL . $this->_t(4) . "\$date = JFactory::getDate()->modify(\$time)->toSql();"; $checkin .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) - . " reset query"; + . " Reset query."; $checkin .= PHP_EOL . $this->_t(4) . "\$query = \$db->getQuery(true);"; $checkin .= PHP_EOL . PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ @@ -21750,7 +21781,7 @@ class Interpretation extends Fields $checkin .= PHP_EOL . $this->_t(4) . ");"; $checkin .= PHP_EOL . PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " Check table"; + ) . " Check table."; $checkin .= PHP_EOL . $this->_t(4) . "\$query->update(\$db->quoteName('#__" . $component . "_" . $view . "'))->set(\$fields)->where(\$conditions); "; @@ -21786,11 +21817,11 @@ class Interpretation extends Fields $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } - $component = ComponentbuilderHelper::safeString($Component); + $component = StringHelper::safe($Component); // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder[$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder[$core['core.access']] ) && in_array( @@ -21862,7 +21893,7 @@ class Interpretation extends Fields } // load the relations before modeling if (isset($this->fieldRelations[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->fieldRelations[$nameListCode] )) { @@ -21883,7 +21914,7 @@ class Interpretation extends Fields } // open the values if (isset($this->{$methodName}[$nameSingleCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->{$methodName}[$nameSingleCode] )) { @@ -22221,7 +22252,7 @@ class Interpretation extends Fields } } /* // set translation (TODO) would be nice to cut down on double loops.. - if (!$export && isset($this->selectionTranslationFixBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$nameListCode])) + if (!$export && isset($this->selectionTranslationFixBuilder[$nameListCode]) && ArrayHelper::check($this->selectionTranslationFixBuilder[$nameListCode])) { foreach ($this->selectionTranslationFixBuilder[$nameListCode] as $name => $values) { @@ -22231,7 +22262,7 @@ class Interpretation extends Fields } */ // load the relations after modeling if (isset($this->fieldRelations[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->fieldRelations[$nameListCode] )) { @@ -22249,8 +22280,8 @@ class Interpretation extends Fields } } // close the foreach if needed - if (ComponentbuilderHelper::checkString($fix) - || ComponentbuilderHelper::checkString($fix_access) + if (StringHelper::check($fix) + || StringHelper::check($fix_access) || $export || $all) { @@ -22284,7 +22315,7 @@ class Interpretation extends Fields // add the permissional removal of values the user has not right to view or access if ($this->strictFieldExportPermissions && isset($this->permissionFields[$nameSingleCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionFields[$nameSingleCode] )) { @@ -22517,6 +22548,7 @@ class Interpretation extends Fields $headers[] = 'use Joomla\Registry\Registry;'; $headers[] = 'use Joomla\String\StringHelper;'; $headers[] = 'use Joomla\Utilities\ArrayHelper;'; + // $headers[] = 'use VDM\Joomla\Utilities;'; // load the internal custom headers $this->setHelperClassHeader($headers, $codeName); break; @@ -22555,7 +22587,7 @@ class Interpretation extends Fields // load the file class if uikit is being loaded if ((2 == $this->uikit || 1 == $this->uikit) && isset($this->uikitComp[$codeName]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->uikitComp[$codeName] )) { @@ -22574,7 +22606,7 @@ class Interpretation extends Fields &$headers) ); // check if headers were added - if (ComponentbuilderHelper::checkArray($headers)) + if (ArrayHelper::check($headers)) { // return the headers return $this->setPlaceholders(implode(PHP_EOL, $headers), $this->placeholders); @@ -22620,7 +22652,7 @@ class Interpretation extends Fields // add category switch $add_category = false; if (isset($this->categoryBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$nameListCode] ) && isset($this->categoryBuilder[$nameListCode]['extension']) @@ -22639,7 +22671,7 @@ class Interpretation extends Fields } // check if this view have filters if (isset($this->filterBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->filterBuilder[$nameListCode] )) { @@ -22700,7 +22732,7 @@ class Interpretation extends Fields // set the language strings for selection $filter_name_select = 'Select Access'; $filter_name_select_lang = $this->langPrefix . '_FILTER_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $filter_name_select, 'U' ); // and to translation @@ -22726,7 +22758,7 @@ class Interpretation extends Fields . $item['code']; // load joint field names if (isset($item['joinfields']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $item['joinfields'] )) { @@ -22769,7 +22801,7 @@ class Interpretation extends Fields // add the fix if this view has the need for it $fix = ''; if (isset($this->selectionTranslationFixBuilder[$views]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->selectionTranslationFixBuilder[$views] )) { @@ -22807,7 +22839,7 @@ class Interpretation extends Fields // add the fix if this view has the need for it $fix = ''; if (isset($this->selectionTranslationFixBuilder[$views]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->selectionTranslationFixBuilder[$views] )) { @@ -22825,7 +22857,7 @@ class Interpretation extends Fields $values ) { - if (ComponentbuilderHelper::checkArray($values)) + if (ArrayHelper::check($values)) { $fix .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ @@ -22839,7 +22871,7 @@ class Interpretation extends Fields foreach ($values as $value => $translang) { // only add quotes to strings - if (ComponentbuilderHelper::checkString($value)) + if (StringHelper::check($value)) { $key = "'" . $value . "'"; } @@ -22928,7 +22960,7 @@ class Interpretation extends Fields public function setDashboardIconAccess() { if (isset($this->permissionDashboard) - && ComponentbuilderHelper::checkArray($this->permissionDashboard)) + && ArrayHelper::check($this->permissionDashboard)) { $this->permissionDashboard = array_unique( $this->permissionDashboard @@ -22947,7 +22979,7 @@ class Interpretation extends Fields public function setDashboardIcons() { if (isset($this->componentData->admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->admin_views )) { @@ -22956,10 +22988,10 @@ class Interpretation extends Fields $catArray = array(); foreach ($this->componentData->admin_views as $view) { - $name_single = ComponentbuilderHelper::safeString( + $name_single = StringHelper::safe( $view['settings']->name_single ); - $name_list = ComponentbuilderHelper::safeString( + $name_list = StringHelper::safe( $view['settings']->name_list ); @@ -22991,11 +23023,11 @@ class Interpretation extends Fields } // build lang $langName = 'Add ' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $view['settings']->name_single, 'W' ) . '

'; $langKey = $this->langPrefix . '_DASHBOARD_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $view['settings']->name_single, 'U' ) . '_ADD'; // add to lang @@ -23028,11 +23060,11 @@ class Interpretation extends Fields $icons .= ", '" . $type . $name_list . "'"; } // build lang - $langName = ComponentbuilderHelper::safeString( + $langName = StringHelper::safe( $view['settings']->name_list, 'W' ) . '

'; $langKey = $this->langPrefix . '_DASHBOARD_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $view['settings']->name_list, 'U' ); // add to lang @@ -23041,7 +23073,7 @@ class Interpretation extends Fields } // dashboard link to category on dashboard is build here if (isset($this->categoryBuilder[$name_list]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$name_list] )) { @@ -23049,14 +23081,14 @@ class Interpretation extends Fields // check if category has another name if (isset($this->catOtherName[$name_list]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->catOtherName[$name_list] )) { $otherViews = $this->catOtherName[$name_list]['views']; $otherNames = $this->catOtherName[$name_list]['name']; // build lang - $langName = ComponentbuilderHelper::safeString( + $langName = StringHelper::safe( $otherNames, 'W' ); } @@ -23065,7 +23097,7 @@ class Interpretation extends Fields $otherViews = $name_list; // build lang $langName = 'Categories For
' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $otherViews, 'W' ); } @@ -23080,9 +23112,9 @@ class Interpretation extends Fields // add to lang $langKey = $this->langPrefix . '_DASHBOARD_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $otherViews, 'U' - ) . '_' . ComponentbuilderHelper::safeString( + ) . '_' . StringHelper::safe( $catCode, 'U' ); $this->setLangContent($this->lang, $langKey, $langName); @@ -23120,7 +23152,7 @@ class Interpretation extends Fields } } if (isset($this->lastCustomDashboardIcon) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->lastCustomDashboardIcon )) { @@ -23131,7 +23163,7 @@ class Interpretation extends Fields unset($this->lastCustomDashboardIcon); } if (isset($this->iconBuilder) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->iconBuilder )) { @@ -23174,13 +23206,13 @@ class Interpretation extends Fields public function setDashboardModelMethods() { if (isset($this->componentData->php_dashboard_methods) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->componentData->php_dashboard_methods )) { // get all the mothods that should load date to the view $this->DashboardGetCustomData - = ComponentbuilderHelper::getAllBetween( + = GetHelper::allBetween( $this->componentData->php_dashboard_methods, 'public function get', '()' ); @@ -23198,7 +23230,7 @@ class Interpretation extends Fields public function setDashboardGetCustomData() { if (isset($this->DashboardGetCustomData) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->DashboardGetCustomData )) { @@ -23207,7 +23239,7 @@ class Interpretation extends Fields // set dashboard gets foreach ($this->DashboardGetCustomData as $get) { - $string = ComponentbuilderHelper::safeString($get); + $string = StringHelper::safe($get); $gets[] = "\$this->" . $string . " = \$this->get('" . $get . "');"; } @@ -23231,7 +23263,7 @@ class Interpretation extends Fields $loadTabs = false; // check if we have custom tabs if (isset($this->componentData->dashboard_tab) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->dashboard_tab )) { @@ -23299,7 +23331,7 @@ class Interpretation extends Fields // load the new tabs foreach ($builder as $tabname => $accordians) { - $alias = ComponentbuilderHelper::safeString($tabname); + $alias = StringHelper::safe($tabname); $display[] = PHP_EOL . $this->_t(2) . " $html) { - $ac_alias = ComponentbuilderHelper::safeString( + $ac_alias = StringHelper::safe( $accordianname ); - $counterName = ComponentbuilderHelper::safeString( + $counterName = StringHelper::safe( $slidecounter ); $tempName = $alias . '_' . $ac_alias; @@ -23334,7 +23366,7 @@ class Interpretation extends Fields $target = array('custom_admin' => $this->componentCodeName); $this->buildDynamique($target, 'template', $tempName); // set the file data - $TARGET = ComponentbuilderHelper::safeString( + $TARGET = StringHelper::safe( $this->target, 'U' ); // SITE_TEMPLATE_BODY <<>> @@ -23370,7 +23402,7 @@ class Interpretation extends Fields { $icon = ''; if (isset($this->componentData->custom_admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->custom_admin_views )) { @@ -23446,17 +23478,17 @@ class Interpretation extends Fields } // see if we should have custom menus if (isset($this->componentData->custommenus) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->custommenus )) { foreach ($this->componentData->custommenus as $nr => $menu) { $nr = $nr + 100; - $nameList = ComponentbuilderHelper::safeString( + $nameList = StringHelper::safe( $menu['name_code'] ); - $nameUpper = ComponentbuilderHelper::safeString( + $nameUpper = StringHelper::safe( $menu['name_code'], 'U' ); if (isset($menu['dashboard_list']) @@ -23484,7 +23516,7 @@ class Interpretation extends Fields // if this is a link build the icon values with pipe if (isset($menu['link']) - && ComponentbuilderHelper::checkString($menu['link'])) + && StringHelper::check($menu['link'])) { // set icon if ($counter == 0) @@ -23540,7 +23572,7 @@ class Interpretation extends Fields // if this is a link build the icon values with pipe if (isset($menu['link']) - && ComponentbuilderHelper::checkString($menu['link'])) + && StringHelper::check($menu['link'])) { // set icon $this->lastCustomDashboardIcon[$nr] = ", '" . $type @@ -23562,7 +23594,7 @@ class Interpretation extends Fields public function setSubMenus() { if (isset($this->componentData->admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->admin_views )) { @@ -23572,7 +23604,7 @@ class Interpretation extends Fields // set the code name $codeName = $this->componentCodeName; // set default dashboard - if (!ComponentbuilderHelper::checkString($this->dynamicDashboard)) + if (!StringHelper::check($this->dynamicDashboard)) { $menus .= "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_DASHBOARD'), 'index.php?option=com_" . $codeName @@ -23592,7 +23624,7 @@ class Interpretation extends Fields ); $nameSingleCode = $view['settings']->name_single_code; $nameListCode = $view['settings']->name_list_code; - $nameUpper = ComponentbuilderHelper::safeString( + $nameUpper = StringHelper::safe( $view['settings']->name_list, 'U' ); // check if view is set to be in the sub-menu @@ -23609,7 +23641,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.access']] ) && in_array( @@ -23637,7 +23669,7 @@ class Interpretation extends Fields ); // check if category has another name if (isset($this->catOtherName[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->catOtherName[$nameListCode] )) { @@ -23652,7 +23684,7 @@ class Interpretation extends Fields // then check if view has category, if true add sub-menu for it if ($view['settings']->add_category_submenu == 1 && isset($this->categoryBuilder[$nameListCode]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->categoryBuilder[$nameListCode] ) && !in_array($otherViews, $catArray)) @@ -23684,7 +23716,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.access']] ) && in_array( @@ -23695,7 +23727,7 @@ class Interpretation extends Fields $menus .= PHP_EOL . $this->_t(2) . "}"; } } - // set the Joomla cutstom fields options + // set the Joomla custom fields options if (isset($view['joomla_fields']) && $view['joomla_fields'] == 1) { @@ -23732,7 +23764,7 @@ class Interpretation extends Fields } } if (isset($this->lastCustomSubMenu) - && ComponentbuilderHelper::checkArray($this->lastCustomSubMenu)) + && ArrayHelper::check($this->lastCustomSubMenu)) { foreach ($this->lastCustomSubMenu as $menu) { @@ -23752,7 +23784,7 @@ class Interpretation extends Fields // see if we should have custom menus $custom = ''; if (isset($this->componentData->custom_admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->custom_admin_views )) { @@ -23770,7 +23802,7 @@ class Interpretation extends Fields } } if (isset($this->componentData->custommenus) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->custommenus )) { @@ -23795,9 +23827,9 @@ class Interpretation extends Fields if ($type === 'customMenu') { $name = $menu['name']; - $nameSingle = ComponentbuilderHelper::safeString($menu['name']); - $nameList = ComponentbuilderHelper::safeString($menu['name']); - $nameUpper = ComponentbuilderHelper::safeString( + $nameSingle = StringHelper::safe($menu['name']); + $nameList = StringHelper::safe($menu['name']); + $nameUpper = StringHelper::safe( $menu['name'], 'U' ); } @@ -23824,7 +23856,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.access']] ) && in_array( @@ -23856,7 +23888,7 @@ class Interpretation extends Fields $tab = $this->_t(1); } if (isset($menu['link']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $menu['link'] )) { @@ -23892,7 +23924,7 @@ class Interpretation extends Fields { // setup access defaults $tab = ""; - $nameSingle = ComponentbuilderHelper::safeString($name); + $nameSingle = StringHelper::safe($name); $coreLoad = false; if (isset($this->permissionCore[$nameSingle])) { @@ -23903,7 +23935,7 @@ class Interpretation extends Fields // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->permissionBuilder['global'][$core['core.access']] ) && in_array( @@ -23929,7 +23961,7 @@ class Interpretation extends Fields $tab = $this->_t(1); } if (isset($menu['link']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $menu['link'] )) { @@ -23964,7 +23996,7 @@ class Interpretation extends Fields public function setMainMenus() { if (isset($this->componentData->admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->admin_views )) { @@ -23984,7 +24016,7 @@ class Interpretation extends Fields // set main menu prefix switch $addPrefix = $this->componentData->add_menu_prefix; if ($addPrefix == 1 && isset($this->componentData->menu_prefix) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->componentData->menu_prefix )) { @@ -24021,10 +24053,10 @@ class Interpretation extends Fields $menus .= $this->addCustomMainMenu($view, $codeName, $lang); if (isset($view['mainmenu']) && $view['mainmenu'] == 1) { - $nameList = ComponentbuilderHelper::safeString( + $nameList = StringHelper::safe( $view['settings']->name_list ); - $nameUpper = ComponentbuilderHelper::safeString( + $nameUpper = StringHelper::safe( $view['settings']->name_list, 'U' ); $menus .= PHP_EOL . $this->_t(3) . '
componentData->config) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->config )) { @@ -24265,11 +24297,11 @@ class Interpretation extends Fields $placeholders[$this->hhh . 'component' . $this->hhh] = $this->componentCodeName; $placeholders[$this->hhh . 'Component' . $this->hhh] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $this->componentData->name_code, 'F' ); $placeholders[$this->hhh . 'COMPONENT' . $this->hhh] - = ComponentbuilderHelper::safeString( + = StringHelper::safe( $this->componentData->name_code, 'U' ); $placeholders[$this->hhh . 'view' . $this->hhh] @@ -24289,7 +24321,7 @@ class Interpretation extends Fields $placeholders[$this->bbb . 'views' . $this->ddd] = $nameListCode; // load the global placeholders - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $this->globalPlaceholders )) { @@ -24325,27 +24357,27 @@ class Interpretation extends Fields // make sure the xml is set and a string if (isset($xmlField) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $xmlField )) { $this->configFieldSetsCustomField[$field['tabname']][] = $xmlField; // set global params to db on install - $fieldName = ComponentbuilderHelper::safeString( + $fieldName = StringHelper::safe( $this->setPlaceholders( - ComponentbuilderHelper::getBetween( + GetHelper::between( $xmlField, 'name="', '"' ), $placeholders ) ); $fieldDefault = $this->setPlaceholders( - ComponentbuilderHelper::getBetween( + GetHelper::between( $xmlField, 'default="', '"' ), $placeholders ); if (isset($field['custom_value']) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $field['custom_value'] )) { @@ -24365,7 +24397,7 @@ class Interpretation extends Fields . '":"' . $field['custom_value'] . '"'; } } - elseif (ComponentbuilderHelper::checkString( + elseif (StringHelper::check( $fieldDefault )) { @@ -24415,7 +24447,7 @@ class Interpretation extends Fields $front_end = array(); // do quick build of front-end views if (isset($this->componentData->site_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->site_views )) { @@ -24429,16 +24461,16 @@ class Interpretation extends Fields // add frontend view stuff including menus if (isset($this->configFieldSetsCustomField) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField )) { foreach ($this->configFieldSetsCustomField as $tab => &$tabFields) { - $tabCode = ComponentbuilderHelper::safeString($tab) + $tabCode = StringHelper::safe($tab) . '_custom_config'; - $tabUpper = ComponentbuilderHelper::safeString($tab, 'U'); - $tabLower = ComponentbuilderHelper::safeString($tab); + $tabUpper = StringHelper::safe($tab, 'U'); + $tabLower = StringHelper::safe($tab); // load the request id setters for menu views $viewRequest = 'name="' . $tabLower . '_request_id'; foreach ($tabFields as $et => $id_field) @@ -24454,7 +24486,7 @@ class Interpretation extends Fields elseif (strpos($id_field, '_request_id') !== false) { // not loaded to a tab "view" name - $_viewRequest = ComponentbuilderHelper::getBetween( + $_viewRequest = GetHelper::between( $id_field, 'name="', '_request_id' ); $searchIdKe = 'name="' . $_viewRequest @@ -24482,7 +24514,7 @@ class Interpretation extends Fields elseif (strpos($catid_field, '_request_catid') !== false) { // not loaded to a tab "view" name - $_viewRequestC = ComponentbuilderHelper::getBetween( + $_viewRequestC = GetHelper::between( $catid_field, 'name="', '_request_catid' ); $searchCatidKe = 'name="' . $_viewRequestC @@ -24507,7 +24539,7 @@ class Interpretation extends Fields elseif (strpos($field, '_menu"') !== false) { // not loaded to a tab "view" name - $_tabLower = ComponentbuilderHelper::getBetween( + $_tabLower = GetHelper::between( $field, 'name="', '_menu"' ); // set the values needed to insure route is done correclty @@ -24529,8 +24561,8 @@ class Interpretation extends Fields protected function setRequestValues($view, $field, $search, $target, $store) { - $key = ComponentbuilderHelper::getBetween($field, $search, '"'); - if (!ComponentbuilderHelper::checkString($key)) + $key = GetHelper::between($field, $search, '"'); + if (!StringHelper::check($key)) { // is not having special var $key = $target; @@ -24556,24 +24588,24 @@ class Interpretation extends Fields { // add custom new global fields set if (isset($this->configFieldSetsCustomField) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField )) { foreach ($this->configFieldSetsCustomField as $tab => $tabFields) { - $tabCode = ComponentbuilderHelper::safeString($tab) + $tabCode = StringHelper::safe($tab) . '_custom_config'; - $tabUpper = ComponentbuilderHelper::safeString($tab, 'U'); - $tabLower = ComponentbuilderHelper::safeString($tab); + $tabUpper = StringHelper::safe($tab, 'U'); + $tabLower = StringHelper::safe($tab); // remove display targeted fields $bucket = array(); foreach ($tabFields as $tabField) { - $display = ComponentbuilderHelper::getBetween( + $display = GetHelper::between( $tabField, 'display="', '"' ); - if (!ComponentbuilderHelper::checkString($display) + if (!StringHelper::check($display) || $display === 'config') { // remove this display since it is not used in Joomla @@ -24583,7 +24615,7 @@ class Interpretation extends Fields } } // only add the tab if it has values - if (ComponentbuilderHelper::checkArray($bucket)) + if (ArrayHelper::check($bucket)) { // setup lang $this->setLangContent( @@ -24610,7 +24642,7 @@ class Interpretation extends Fields { // start loading Group control params if needed if (isset($this->setGroupControl) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->setGroupControl )) { @@ -24650,7 +24682,7 @@ class Interpretation extends Fields } // add custom Target Groups fields if (isset($this->configFieldSetsCustomField['Target Groups']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField['Target Groups'] )) { @@ -24793,7 +24825,7 @@ class Interpretation extends Fields } // add custom global fields if (isset($this->configFieldSetsCustomField['Global']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField['Global'] )) { @@ -24852,7 +24884,7 @@ class Interpretation extends Fields $langCont = $lang . '_CONTRIBUTOR'; if (isset($this->addContributors) && $this->addContributors && isset($this->componentData->contributors) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->contributors )) { @@ -24863,7 +24895,7 @@ class Interpretation extends Fields // make sure we dont use 0 $counter++; // get the word for this number - $COUNTER = ComponentbuilderHelper::safeString($counter, 'U'); + $COUNTER = StringHelper::safe($counter, 'U'); // set the dynamic values $cbTitle = htmlspecialchars( $contributor['title'], ENT_XML1, 'UTF-8' @@ -24876,7 +24908,7 @@ class Interpretation extends Fields ); $cbWebsite = htmlspecialchars( $contributor['website'], ENT_XML1, 'UTF-8' - ); // ComponentbuilderHelper::htmlEscape($contributor['website']); + ); // StringHelper::html($contributor['website']); // load to the $fieldsets $this->configFieldSets[] = $this->_t(2) . 'configFieldSets[] = $this->_t(2) . '"; // setup lang - $Counter = ComponentbuilderHelper::safeString($counter, 'Ww'); + $Counter = StringHelper::safe($counter, 'Ww'); $this->setLangContent( $this->lang, $langCont . '_' . $COUNTER, "Contributor " . $Counter @@ -25388,7 +25420,7 @@ for developing fast and powerful web interfaces. For more info visit configFieldSetsCustomField['Uikit Settings']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField['Uikit Settings'] )) { @@ -25422,7 +25454,7 @@ for developing fast and powerful web interfaces. For more info visit "; // add custom Mail Configurations if (isset($this->configFieldSetsCustomField['Mail Configuration']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField['Mail Configuration'] )) { @@ -25890,7 +25922,7 @@ for developing fast and powerful web interfaces. For more info visit "; // add custom DKIM fields if (isset($this->configFieldSetsCustomField['DKIM']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField['DKIM'] )) { @@ -26623,7 +26655,7 @@ function vdm_dkim() { // add custom Encryption Settings fields if (isset($this->configFieldSetsCustomField['Chart Settings']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField['Chart Settings'] )) { @@ -26769,7 +26801,7 @@ function vdm_dkim() { || (isset($this->mediumEncryption) && $this->mediumEncryption) || $this->componentData->add_license || (isset($this->configFieldSetsCustomField['Encryption Settings']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField['Encryption Settings'] ))) { @@ -27059,7 +27091,7 @@ function vdm_dkim() { { // add custom Encryption Settings fields if (isset($this->configFieldSetsCustomField[$dynamicAddField]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->configFieldSetsCustomField[$dynamicAddField] )) { @@ -27161,9 +27193,9 @@ function vdm_dkim() { if ($this->addEximport) { $exportTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Export Data', 'U'); + . StringHelper::safe('Export Data', 'U'); $exportDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Export Data', 'U') + . StringHelper::safe('Export Data', 'U') . '_DESC'; $this->setLangContent('bothadmin', $exportTitle, 'Export Data'); $this->setLangContent( @@ -27176,9 +27208,9 @@ function vdm_dkim() { // the size needs increase $this->accessSize++; $importTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Import Data', 'U'); + . StringHelper::safe('Import Data', 'U'); $importDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Import Data', 'U') + . StringHelper::safe('Import Data', 'U') . '_DESC'; $this->setLangContent('bothadmin', $importTitle, 'Import Data'); $this->setLangContent( @@ -27193,9 +27225,9 @@ function vdm_dkim() { } // version permission $batchTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Use Batch', 'U'); + . StringHelper::safe('Use Batch', 'U'); $batchDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Use Batch', 'U') . '_DESC'; + . StringHelper::safe('Use Batch', 'U') . '_DESC'; $this->setLangContent('bothadmin', $batchTitle, 'Use Batch'); $this->setLangContent( 'bothadmin', $batchDesc, @@ -27206,9 +27238,9 @@ function vdm_dkim() { . '" description="' . $batchDesc . '" />'; // version permission $importTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Edit Versions', 'U'); + . StringHelper::safe('Edit Versions', 'U'); $importDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Edit Versions', 'U') + . StringHelper::safe('Edit Versions', 'U') . '_DESC'; $this->setLangContent('bothadmin', $importTitle, 'Edit Version'); $this->setLangContent( @@ -27239,9 +27271,9 @@ function vdm_dkim() { } // new custom created by permissions $created_byTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Edit Created By', 'U'); + . StringHelper::safe('Edit Created By', 'U'); $created_byDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Edit Created By', 'U') + . StringHelper::safe('Edit Created By', 'U') . '_DESC'; $this->setLangContent('bothadmin', $created_byTitle, 'Edit Created By'); $this->setLangContent( @@ -27253,9 +27285,9 @@ function vdm_dkim() { . '" description="' . $created_byDesc . '" />'; // new custom created date permissions $createdTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Edit Created Date', 'U'); + . StringHelper::safe('Edit Created Date', 'U'); $createdDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString('Edit Created Date', 'U') + . StringHelper::safe('Edit Created Date', 'U') . '_DESC'; $this->setLangContent('bothadmin', $createdTitle, 'Edit Created Date'); $this->setLangContent( @@ -27271,7 +27303,7 @@ function vdm_dkim() { 'dashboard_add'); // set the custom admin views permissions if (isset($this->componentData->custom_admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->custom_admin_views )) { @@ -27283,14 +27315,14 @@ function vdm_dkim() { $customAdminName = $custom_admin_view['settings']->name; $customAdminCode = $custom_admin_view['settings']->code; $customAdminTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $customAdminName . ' Access', 'U' ); $customAdminDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $customAdminName . ' Access', 'U' ) . '_DESC'; - $sortKey = ComponentbuilderHelper::safeString( + $sortKey = StringHelper::safe( $customAdminName . ' Access' ); $this->setLangContent( @@ -27299,7 +27331,7 @@ function vdm_dkim() { $this->setLangContent( 'bothadmin', $customAdminDesc, ' Allows the users in this group to access ' - . ComponentbuilderHelper::safeString($customAdminName, 'w') + . StringHelper::safe($customAdminName, 'w') . '.' ); $this->componentGlobal[$sortKey] = $this->_t(2) @@ -27330,7 +27362,7 @@ function vdm_dkim() { . $menuController; $menucontrollerView['implementation'] = '2'; if (isset($custom_admin_view['settings']->permissions) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $custom_admin_view['settings']->permissions )) { @@ -27357,7 +27389,7 @@ function vdm_dkim() { } // set the site views permissions if (isset($this->componentData->site_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->site_views )) { @@ -27367,14 +27399,14 @@ function vdm_dkim() { $siteName = $site_view['settings']->name; $siteCode = $site_view['settings']->code; $siteTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $siteName . ' Access Site', 'U' ); $siteDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $siteName . ' Access Site', 'U' ) . '_DESC'; - $sortKey = ComponentbuilderHelper::safeString( + $sortKey = StringHelper::safe( $siteName . ' Access Site' ); if (isset($site_view['access']) && $site_view['access'] == 1) @@ -27385,7 +27417,7 @@ function vdm_dkim() { $this->setLangContent( 'bothadmin', $siteDesc, ' Allows the users in this group to access site ' - . ComponentbuilderHelper::safeString($siteName, 'w') + . StringHelper::safe($siteName, 'w') . '.' ); $this->componentGlobal[$sortKey] = $this->_t(2) @@ -27409,22 +27441,22 @@ function vdm_dkim() { } } if (isset($this->componentData->admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->admin_views )) { foreach ($this->componentData->admin_views as $view) { // set view name - $nameView = ComponentbuilderHelper::safeString( + $nameView = StringHelper::safe( $view['settings']->name_single ); - $nameViews = ComponentbuilderHelper::safeString( + $nameViews = StringHelper::safe( $view['settings']->name_list ); // add custom tab permissions if found if (isset($this->customTabs[$nameView]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->customTabs[$nameView] )) { @@ -27468,7 +27500,7 @@ function vdm_dkim() { . $menuController; $menucontrollerView['implementation'] = '2'; if (isset($view['settings']->permissions) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->permissions )) { @@ -27487,7 +27519,7 @@ function vdm_dkim() { } } // check if there are fields - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->fields )) { @@ -27499,11 +27531,11 @@ function vdm_dkim() { { // see if field require permissions to be set if (isset($field['permission']) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $field['permission'] )) { - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $field['settings']->properties )) { @@ -27528,7 +27560,7 @@ function vdm_dkim() { $fieldView['implementation'] = '3'; // check if persmissions was already set if (isset($view['settings']->permissions) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->permissions )) { @@ -27551,7 +27583,7 @@ function vdm_dkim() { { // make sure the array is set if (!isset($this->permissionFields[$nameView]) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->permissionFields[$nameView] )) { @@ -27559,7 +27591,7 @@ function vdm_dkim() { = array(); } if (!isset($this->permissionFields[$nameView][$fieldName]) - || !ComponentbuilderHelper::checkArray( + || !ArrayHelper::check( $this->permissionFields[$nameView][$fieldName] )) { @@ -27588,7 +27620,7 @@ function vdm_dkim() { ); // set the views permissions now - if (ComponentbuilderHelper::checkArray($this->permissionViews)) + if (ArrayHelper::check($this->permissionViews)) { foreach ($this->permissionViews as $viewsCodeName => $actions) { @@ -27626,10 +27658,10 @@ function vdm_dkim() { { // get the worse case column size required (can be worse I know) // access/action size x 20 characters x 8 groups - $character_length = (int) ComponentbuilderHelper::bcmath( + $character_length = (int) MathHelper::bc( 'mul', $this->accessSize, 20, 0 ); - $this->accessWorseCase = (int) ComponentbuilderHelper::bcmath( + $this->accessWorseCase = (int) MathHelper::bc( 'mul', $character_length, 8, 0 ); } @@ -27645,25 +27677,25 @@ function vdm_dkim() { { // add the custom permissions to use the buttons of this view if (isset($settings->custom_buttons) - && ComponentbuilderHelper::checkArray($settings->custom_buttons)) + && ArrayHelper::check($settings->custom_buttons)) { foreach ($settings->custom_buttons as $custom_buttons) { $customButtonName = $custom_buttons['name']; - $customButtonCode = ComponentbuilderHelper::safeString( + $customButtonCode = StringHelper::safe( $customButtonName ); $customButtonTitle = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $nameView . ' ' . $customButtonName . ' Button Access', 'U' ); $customButtonDesc = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $nameView . ' ' . $customButtonName . ' Button Access', 'U' ) . '_DESC'; - $sortButtonKey = ComponentbuilderHelper::safeString( + $sortButtonKey = StringHelper::safe( $nameView . ' ' . $customButtonName . ' Button Access' ); $this->setLangContent( @@ -27673,7 +27705,7 @@ function vdm_dkim() { $this->setLangContent( 'bothadmin', $customButtonDesc, ' Allows the users in this group to access the ' - . ComponentbuilderHelper::safeString($customButtonName, 'w') + . StringHelper::safe($customButtonName, 'w') . ' button.' ); $this->componentGlobal[$sortButtonKey] = $this->_t(2) @@ -27691,7 +27723,7 @@ function vdm_dkim() { ) { if (isset($view['settings']->permissions) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $view['settings']->permissions ) || (isset($view['port']) && $view['port']) @@ -27703,7 +27735,7 @@ function vdm_dkim() { // export $exportView['action'] = 'view.export'; $exportView['implementation'] = '2'; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->permissions )) { @@ -27717,7 +27749,7 @@ function vdm_dkim() { // import $importView['action'] = 'view.import'; $importView['implementation'] = '2'; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->permissions )) { @@ -27735,7 +27767,7 @@ function vdm_dkim() { // set version control $versionView['action'] = 'view.version'; $versionView['implementation'] = '3'; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->permissions )) { @@ -27753,7 +27785,7 @@ function vdm_dkim() { // set batch control $batchView['action'] = 'view.batch'; $batchView['implementation'] = '2'; - if (ComponentbuilderHelper::checkArray( + if (ArrayHelper::check( $view['settings']->permissions )) { @@ -27799,19 +27831,19 @@ function vdm_dkim() { // build the names if ($type === 'admin') { - $W_NameList = ComponentbuilderHelper::safeString( + $W_NameList = StringHelper::safe( $view['settings']->name_list, 'W' ); - $w_NameList = ComponentbuilderHelper::safeString( + $w_NameList = StringHelper::safe( $customName . ' ' . $view['settings']->name_list, 'w' ); - $w_NameSingle = ComponentbuilderHelper::safeString( + $w_NameSingle = StringHelper::safe( $view['settings']->name_single, 'w' ); } elseif ($type === 'customAdmin') { - $W_NameList = ComponentbuilderHelper::safeString( + $W_NameList = StringHelper::safe( $view['settings']->name, 'W' ); $w_NameList = $view['settings']->name; @@ -27819,7 +27851,7 @@ function vdm_dkim() { } // set title (only if not set already) if (!isset($permission['title']) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $permission['title'] )) { @@ -27884,7 +27916,7 @@ function vdm_dkim() { default: // set edit title $permission['title'] = $W_NameList . ' ' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $customName, 'W' ); break; @@ -27892,7 +27924,7 @@ function vdm_dkim() { } // set description (only if not set already) if (!isset($permission['description']) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $permission['description'] )) { @@ -27981,7 +28013,7 @@ function vdm_dkim() { // set edit description $permission['description'] = ' Allows the users in this group to ' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $customName, 'w' ) . ' of ' . $w_NameSingle; break; @@ -27997,12 +28029,12 @@ function vdm_dkim() { ); $this->permissionCore[$nameView][$coreTarget] = $action; // set array sort name - $sortKey = ComponentbuilderHelper::safeString( + $sortKey = StringHelper::safe( $permission['title'] ); // set title $title = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString( + . StringHelper::safe( $permission['title'], 'U' ); // load the actions @@ -28197,7 +28229,7 @@ function vdm_dkim() { { $setter = ''; if (isset($this->libManager[$module->key][$module->code_name]) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->libManager[$module->key][$module->code_name] )) { @@ -28210,18 +28242,18 @@ function vdm_dkim() { ) { if (isset($this->libraries[$id]) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $this->libraries[$id] ) && isset($this->libraries[$id]->document) - && ComponentbuilderHelper::checkString( + && StringHelper::check( $this->libraries[$id]->document )) { $setter .= PHP_EOL . $this->libraries[$id]->document; } elseif (isset($this->libraries[$id]) - && ComponentbuilderHelper::checkObject( + && ObjectHelper::check( $this->libraries[$id] ) && isset($this->libraries[$id]->how)) @@ -28231,7 +28263,7 @@ function vdm_dkim() { } } // check if we have string - if (ComponentbuilderHelper::checkString($setter)) + if (StringHelper::check($setter)) { return $this->setPlaceholders( $this->setPlaceholders( str_replace( @@ -28262,7 +28294,7 @@ function vdm_dkim() { // build the config fields $config_fields = array(); if (isset($module->config_fields) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $module->config_fields )) { @@ -28286,7 +28318,7 @@ function vdm_dkim() { } // make sure the xml is set and a string if (isset($xmlFields) - && ComponentbuilderHelper::checkString($xmlFields)) + && StringHelper::check($xmlFields)) { $config_fields[$field_name . $fieldset] = $xmlFields; } @@ -28340,7 +28372,7 @@ function vdm_dkim() { &$this->langTag) ); // now we insert the values into the files - if (ComponentbuilderHelper::checkArray($this->languages['modules'])) + if (ArrayHelper::check($this->languages['modules'])) { foreach ($this->languages['modules'] as $tag => $areas) { @@ -28437,7 +28469,7 @@ function vdm_dkim() { $xml .= PHP_EOL . $this->_t(1) . ''; } // should the language xml be added - if (ComponentbuilderHelper::checkArray($addLang)) + if (ArrayHelper::check($addLang)) { $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; - $xml .= PHP_EOL . $this->_t(1) . '
target == 2) { - $xml .= PHP_EOL . $this->_t(2) - . 'addrulepath="/administrator/modules/' - . $module->file_name - . '/rules"'; - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/administrator/modules/' - . $module->file_name - . '/fields"'; + if (!isset($module->add_rule_path[$field_name . $fieldset])) + { + $module->add_rule_path[$field_name . $fieldset] = + '/administrator/modules/' + . $module->file_name . '/rules'; + } + + if (!isset($module->add_field_path[$field_name . $fieldset])) + { + $module->add_field_path[$field_name . $fieldset] = + '/administrator/modules/' + . $module->file_name . '/fields'; + } } else { - $xml .= PHP_EOL . $this->_t(2) - . 'addrulepath="/modules/' . $module->file_name - . '/rules"'; - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/modules/' . $module->file_name - . '/fields"'; + if (!isset($module->add_rule_path[$field_name . $fieldset])) + { + $module->add_rule_path[$field_name . $fieldset] = + '/modules/' . $module->file_name + . '/rules'; + } + + if (!isset($module->add_field_path[$field_name . $fieldset])) + { + $module->add_field_path[$field_name . $fieldset] = + '/modules/' . $module->file_name + . '/fields'; + } } + } + // add path to module rules and custom fields + if (isset($module->add_rule_path[$field_name . $fieldset]) + || isset($module->add_field_path[$field_name . $fieldset])) + { + + $xml .= PHP_EOL . $this->_t(1) . ''; + + $xml .= PHP_EOL . $this->_t(1) . '
add_rule_path[$field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addrulepath="' . $module->add_rule_path[$field_name . $fieldset] . '"'; + } + + if (isset($module->add_field_path[$field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addfieldpath="' . $module->add_field_path[$field_name . $fieldset] . '"'; + } + $xml .= PHP_EOL . $this->_t(1) . '>'; } else @@ -28628,7 +28689,7 @@ function vdm_dkim() { // build the config fields $config_fields = array(); if (isset($plugin->config_fields) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $plugin->config_fields )) { @@ -28642,7 +28703,7 @@ function vdm_dkim() { ); // make sure the xml is set and a string if (isset($xmlFields) - && ComponentbuilderHelper::checkString($xmlFields)) + && StringHelper::check($xmlFields)) { $config_fields[$field_name . $fieldset] = $xmlFields; } @@ -28696,7 +28757,7 @@ function vdm_dkim() { &$this->langTag) ); // now we insert the values into the files - if (ComponentbuilderHelper::checkArray($this->languages['plugins'])) + if (ArrayHelper::check($this->languages['plugins'])) { foreach ($this->languages['plugins'] as $tag => $areas) { @@ -28798,7 +28859,7 @@ function vdm_dkim() { $xml .= PHP_EOL . $this->_t(1) . ''; } // should the language xml be added - if (ComponentbuilderHelper::checkArray($addLang)) + if (ArrayHelper::check($addLang)) { $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . '
_t(2) - . 'addrulepath="/plugins/' . strtolower( - $plugin->group - ) . '/' . strtolower($plugin->code_name) - . '/rules"'; - $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/plugins/' . strtolower( - $plugin->group - ) . '/' . strtolower($plugin->code_name) - . '/fields"'; + + if (isset($plugin->add_rule_path[$field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addrulepath="' . $plugin->add_rule_path[$field_name . $fieldset] . '"'; + } + + if (isset($plugin->add_field_path[$field_name . $fieldset])) + { + $xml .= PHP_EOL . $this->_t(2) + . 'addfieldpath="' . $plugin->add_field_path[$field_name . $fieldset] . '"'; + } + $xml .= PHP_EOL . $this->_t(1) . '>'; } else @@ -28966,37 +29048,37 @@ function vdm_dkim() { // set the name space $code[] = 'namespace ' . $power->_namespace . ';' . PHP_EOL; // check if we have header data - if (ComponentbuilderHelper::checkString($power->head)) + if (StringHelper::check($power->head)) { $code[] = PHP_EOL . $power->head; } // add description if set - if (ComponentbuilderHelper::checkString($power->description)) + if (StringHelper::check($power->description)) { // check if this is escaped if (strpos($power->description, '/*') === false) { // make this description escaped - $power->description = '/**' . PHP_EOL . ' * ' . implode(' * ', explode(PHP_EOL, $power->description)) . PHP_EOL . ' */'; + $power->description = '/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', explode(PHP_EOL, $power->description)) . PHP_EOL . ' */'; } $code[] = PHP_EOL . $power->description; } // build power declaration $declaration = $power->type . ' ' . $power->class_name; // check if we have extends - if (ComponentbuilderHelper::checkString($power->extends_name)) + if (StringHelper::check($power->extends_name)) { $declaration .= ' extends ' . $power->extends_name; } // check if we have implements - if (ComponentbuilderHelper::checkArray($power->implement_names)) + if (ArrayHelper::check($power->implement_names)) { $declaration .= ' implements ' . implode(', ', $power->implement_names); } $code[] = $declaration; $code[] = '{'; // add the main code if set - if (ComponentbuilderHelper::checkString($power->main_class_code)) + if (StringHelper::check($power->main_class_code)) { $code[] = $power->main_class_code; } @@ -29007,28 +29089,18 @@ function vdm_dkim() { public function setPowersAutoloader($namespace, $loadSite) { - if (($size = ComponentbuilderHelper::checkArray($namespace)) > 0) + if (($size = ArrayHelper::check($namespace)) > 0) { // check if we are using a plugin $use_plugin = isset($this->fileContentStatic[$this->hhh . 'PLUGIN_POWER_AUTOLOADER' . $this->hhh]); - // add only if we are not using a plugin - if (!$use_plugin) - { - // build the trigger declaration - $trigger = array(); - $trigger[] = PHP_EOL . PHP_EOL . '// Trigger the Autoloader of the Powers Libraries'; - $trigger[] = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper::powersAutoloader();'; - } // build the helper method $helperMethod = array(); // add only if we are not using a plugin + $tab_space = 2; if (!$use_plugin) { - $helperMethod[] = PHP_EOL . PHP_EOL . $this->_t(1) . '/**'; - $helperMethod[] = $this->_t(1) . '* The powers autoloader.'; - $helperMethod[] = $this->_t(1) . '**/'; - $helperMethod[] = $this->_t(1) . 'public static function powersAutoloader()'; - $helperMethod[] = $this->_t(1) . '{'; + $helperMethod[] = PHP_EOL . PHP_EOL; + $tab_space = 0; } elseif (!$loadSite) { @@ -29040,12 +29112,13 @@ function vdm_dkim() { $helperMethod[] = $this->_t(3) . 'return;'; $helperMethod[] = $this->_t(2) . '}' . PHP_EOL; } - $helperMethod[] = $this->_t(2) . '//' + // we start building the spl_autoload_register function call + $helperMethod[] = $this->_t($tab_space) . '//' . $this->setLine(__LINE__) . ' register this component namespace'; - $helperMethod[] = $this->_t(2) . 'spl_autoload_register(function ($class) {'; - $helperMethod[] = $this->_t(3) . '//' + $helperMethod[] = $this->_t($tab_space) . 'spl_autoload_register(function ($class) {'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '//' . $this->setLine(__LINE__) . ' project-specific base directories and namespace prefix'; - $helperMethod[] = $this->_t(3) . '$search = array('; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '$search = array('; // ==== IMPORTANT NOTICE ===== // make sure the name space values are sorted from the longest string to the shortest // so that the search do not mistakenly match a shorter namespace before a longer one @@ -29067,64 +29140,59 @@ function vdm_dkim() { // don't add the ending comma on last value if ($size == $counter) { - $helperMethod[] = $this->_t(4) . "'$this->jcbPowersPath/$base_dir' => '" . implode('\\\\', $prefix) . "'"; + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . "'$this->jcbPowersPath/$base_dir' => '" . implode('\\\\', $prefix) . "'"; } else { - $helperMethod[] = $this->_t(4) . "'$this->jcbPowersPath/$base_dir' => '" . implode('\\\\', $prefix) . "',"; + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . "'$this->jcbPowersPath/$base_dir' => '" . implode('\\\\', $prefix) . "',"; } $counter++; } - $helperMethod[] = $this->_t(3) . ');'; - $helperMethod[] = $this->_t(3) . '// Start the search and load if found'; - $helperMethod[] = $this->_t(3) . '$found = false;'; - $helperMethod[] = $this->_t(3) . '$found_base_dir = "";'; - $helperMethod[] = $this->_t(3) . '$found_len = 0;'; - $helperMethod[] = $this->_t(3) . 'foreach ($search as $base_dir => $prefix)'; - $helperMethod[] = $this->_t(3) . '{'; - $helperMethod[] = $this->_t(4) . '//' + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . ');'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '// Start the search and load if found'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '$found = false;'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '$found_base_dir = "";'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '$found_len = 0;'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . 'foreach ($search as $base_dir => $prefix)'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '{'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . '//' . $this->setLine(__LINE__) . ' does the class use the namespace prefix?'; - $helperMethod[] = $this->_t(4) . '$len = strlen($prefix);'; - $helperMethod[] = $this->_t(4) . 'if (strncmp($prefix, $class, $len) === 0)'; - $helperMethod[] = $this->_t(4) . '{'; - $helperMethod[] = $this->_t(5) . '//' + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . '$len = strlen($prefix);'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . 'if (strncmp($prefix, $class, $len) === 0)'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . '{'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(3) . '//' . $this->setLine(__LINE__) . ' we have a match so load the values'; - $helperMethod[] = $this->_t(5) . '$found = true;'; - $helperMethod[] = $this->_t(5) . '$found_base_dir = $base_dir;'; - $helperMethod[] = $this->_t(5) . '$found_len = $len;'; - $helperMethod[] = $this->_t(5) . '//' + $helperMethod[] = $this->_t($tab_space) . $this->_t(3) . '$found = true;'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(3) . '$found_base_dir = $base_dir;'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(3) . '$found_len = $len;'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(3) . '//' . $this->setLine(__LINE__) . ' done here'; - $helperMethod[] = $this->_t(5) . 'break;'; - $helperMethod[] = $this->_t(4) . '}'; - $helperMethod[] = $this->_t(3) . '}'; - $helperMethod[] = $this->_t(3) . '//' + $helperMethod[] = $this->_t($tab_space) . $this->_t(3) . 'break;'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . '}'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '}'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '//' . $this->setLine(__LINE__) . ' check if we found a match'; - $helperMethod[] = $this->_t(3) . 'if (!$found)'; - $helperMethod[] = $this->_t(3) . '{'; - $helperMethod[] = $this->_t(4) . '//' + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . 'if (!$found)'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '{'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . '//' . $this->setLine(__LINE__) . ' no, move to the next registered autoloader'; - $helperMethod[] = $this->_t(4) . 'return;'; - $helperMethod[] = $this->_t(3) . '}'; - $helperMethod[] = $this->_t(3) . '//' + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . 'return;'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '}'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '//' . $this->setLine(__LINE__) . ' get the relative class name'; - $helperMethod[] = $this->_t(3) . '$relative_class = substr($class, $found_len);'; - $helperMethod[] = $this->_t(3) . '//' + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '$relative_class = substr($class, $found_len);'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '//' . $this->setLine(__LINE__) . ' replace the namespace prefix with the base directory, replace namespace'; - $helperMethod[] = $this->_t(3) . '// separators with directory separators in the relative class name, append'; - $helperMethod[] = $this->_t(3) . '// with .php'; - $helperMethod[] = $this->_t(3) . "\$file = JPATH_ROOT . '/' . \$found_base_dir . '/src' . str_replace('\\\\', '/', \$relative_class) . '.php';"; - $helperMethod[] = $this->_t(3) . '//' + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '// separators with directory separators in the relative class name, append'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '// with .php'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . "\$file = JPATH_ROOT . '/' . \$found_base_dir . '/src' . str_replace('\\\\', '/', \$relative_class) . '.php';"; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '//' . $this->setLine(__LINE__) . ' if the file exists, require it'; - $helperMethod[] = $this->_t(3) . 'if (file_exists($file))'; - $helperMethod[] = $this->_t(3) . '{'; - $helperMethod[] = $this->_t(4) . 'require $file;'; - $helperMethod[] = $this->_t(3) . '}'; - $helperMethod[] = $this->_t(2) . '});'; - // add only if we are not using a plugin - if (!$use_plugin) - { - $helperMethod[] = $this->_t(1) . '}'; - } + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . 'if (file_exists($file))'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '{'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(2) . 'require $file;'; + $helperMethod[] = $this->_t($tab_space) . $this->_t(1) . '}'; + $helperMethod[] = $this->_t($tab_space) . '});'; // check if we are using a plugin if ($use_plugin) { @@ -29133,13 +29201,11 @@ function vdm_dkim() { else { // load to events placeholders - $this->fileContentStatic[$this->hhh . 'ADMIN_POWER_EVENT' . $this->hhh] .= implode(PHP_EOL, $trigger); - $this->fileContentStatic[$this->hhh . 'ADMIN_POWER_EVENT_HELPER' . $this->hhh] .= implode(PHP_EOL, $helperMethod); + $this->fileContentStatic[$this->hhh . 'ADMIN_POWER_HELPER' . $this->hhh] .= implode(PHP_EOL, $helperMethod); // load to site if needed if ($loadSite) { - $this->fileContentStatic[$this->hhh . 'SITE_POWER_EVENT' . $this->hhh] .= implode(PHP_EOL, $trigger); - $this->fileContentStatic[$this->hhh . 'SITE_POWER_EVENT_HELPER' . $this->hhh] .= implode(PHP_EOL, $helperMethod); + $this->fileContentStatic[$this->hhh . 'SITE_POWER_HELPER' . $this->hhh] .= implode(PHP_EOL, $helperMethod); } } } @@ -29179,7 +29245,7 @@ function vdm_dkim() { // set constructor if (isset($extension->add_php_script_construct) && $extension->add_php_script_construct == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $extension->php_script_construct )) { @@ -29216,7 +29282,7 @@ function vdm_dkim() { ) && $extension->{'add_' . $scriptMethod . '_' . $scriptType} == 1 - && ComponentbuilderHelper::checkString( + && StringHelper::check( $extension->{$scriptMethod . '_' . $scriptType} )) { @@ -29237,21 +29303,21 @@ function vdm_dkim() { } } // now add the install script. - if (ComponentbuilderHelper::checkArray($function_install)) + if (ArrayHelper::check($function_install)) { $script .= $this->setInstallMethodScript( 'install', $function_install ); } // now add the update script. - if (ComponentbuilderHelper::checkArray($function_update)) + if (ArrayHelper::check($function_update)) { $script .= $this->setInstallMethodScript( 'update', $function_update ); } // now add the uninstall script. - if (ComponentbuilderHelper::checkArray($function_uninstall)) + if (ArrayHelper::check($function_uninstall)) { $script .= $this->setInstallMethodScript( 'uninstall', $function_uninstall @@ -29348,7 +29414,7 @@ function vdm_dkim() { // now add the scripts foreach ($scripts as $route => $_script) { - if (ComponentbuilderHelper::checkArray($_script)) + if (ArrayHelper::check($_script)) { // set the if and script $script .= PHP_EOL . $this->_t(2) . "if ('" . $route @@ -29400,10 +29466,10 @@ function vdm_dkim() { if ($this->langTag !== $tag) { $langStringNr = count($languageStrings); - $langStringSum = ComponentbuilderHelper::bcmath( + $langStringSum = MathHelper::bc( 'mul', $langStringNr, 100 ); - $percentage = ComponentbuilderHelper::bcmath( + $percentage = MathHelper::bc( 'div', $langStringSum, $total ); $stringNAme = ($langStringNr == 1) ? '(string ' diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 4cd4ccc89..2354ad3f9 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -15,6 +15,10 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\FileHelper; /** * Infusion class @@ -68,7 +72,7 @@ class Infusion extends Interpretation protected function buildFileContent() { if (isset($this->componentData->admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->admin_views )) { @@ -157,7 +161,7 @@ class Infusion extends Interpretation } // load only first two values if (isset($versionArray) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $versionArray ) && $this->componentData->mvc_versiondate == 2) @@ -167,7 +171,7 @@ class Infusion extends Interpretation } // load only the first value elseif (isset($versionArray) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $versionArray ) && $this->componentData->mvc_versiondate == 3) @@ -356,7 +360,7 @@ class Infusion extends Interpretation = $this->addEmailHelper(); // load the global placeholders - if (ComponentbuilderHelper::checkArray($this->globalPlaceholders)) + if (ArrayHelper::check($this->globalPlaceholders)) { foreach ( $this->globalPlaceholders as $globalPlaceholder => @@ -1030,7 +1034,7 @@ class Infusion extends Interpretation $scriptNote, true, false, PHP_EOL )) !== false - && ComponentbuilderHelper::checkString($footerScript)) + && StringHelper::check($footerScript)) { // only minfy if no php is added to the footer script if ($this->minify @@ -1296,7 +1300,7 @@ class Infusion extends Interpretation // setup custom_admin_views and all needed stuff for the site if (isset($this->componentData->custom_admin_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->custom_admin_views )) { @@ -1667,7 +1671,7 @@ class Infusion extends Interpretation $this->setVersionController(); // only set these if default dashboard it used - if (!ComponentbuilderHelper::checkString($this->dynamicDashboard)) + if (!StringHelper::check($this->dynamicDashboard)) { // DASHBOARDVIEW $this->fileContentStatic[$this->hhh . 'DASHBOARDVIEW' @@ -1801,7 +1805,7 @@ class Infusion extends Interpretation // build the validation rules if (isset($this->validationRules) - && ComponentbuilderHelper::checkArray($this->validationRules)) + && ArrayHelper::check($this->validationRules)) { foreach ($this->validationRules as $rule => $_php) { @@ -1821,13 +1825,13 @@ class Infusion extends Interpretation // run the second run if needed if (isset($this->secondRunAdmin) - && ComponentbuilderHelper::checkArray($this->secondRunAdmin)) + && ArrayHelper::check($this->secondRunAdmin)) { // start dynamic build foreach ($this->secondRunAdmin as $function => $arrays) { - if (ComponentbuilderHelper::checkArray($arrays) - && ComponentbuilderHelper::checkString($function)) + if (ArrayHelper::check($arrays) + && StringHelper::check($function)) { foreach ($arrays as $array) { @@ -1846,7 +1850,7 @@ class Infusion extends Interpretation // setup front-views and all needed stuff for the site if (isset($this->componentData->site_views) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $this->componentData->site_views )) { @@ -2072,7 +2076,7 @@ class Infusion extends Interpretation if ($view['settings']->main_get->gettype == 1) { // insure the controller headers are added - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $view['settings']->php_controller ) && $view['settings']->php_controller != '//') @@ -2106,7 +2110,7 @@ class Infusion extends Interpretation elseif ($view['settings']->main_get->gettype == 2) { // insure the controller headers are added - if (ComponentbuilderHelper::checkString( + if (StringHelper::check( $view['settings']->php_controller ) && $view['settings']->php_controller != '//') @@ -2286,7 +2290,7 @@ class Infusion extends Interpretation $this->fileContentStatic[$this->hhh . 'ROUTER_BUILD_VIEWS' . $this->hhh] ) - || !ComponentbuilderHelper::checkString( + || !StringHelper::check( $this->fileContentStatic[$this->hhh . 'ROUTER_BUILD_VIEWS' . $this->hhh] )) @@ -2310,18 +2314,16 @@ class Infusion extends Interpretation = $this->componentData->readme; } // remove all the power placeholders - $this->fileContentStatic[$this->hhh . 'ADMIN_POWER_EVENT_HELPER' . $this->hhh] = ''; - $this->fileContentStatic[$this->hhh . 'ADMIN_POWER_EVENT' . $this->hhh] = ''; - $this->fileContentStatic[$this->hhh . 'SITE_POWER_EVENT_HELPER' . $this->hhh] = ''; - $this->fileContentStatic[$this->hhh . 'SITE_POWER_EVENT' . $this->hhh] = ''; + $this->fileContentStatic[$this->hhh . 'ADMIN_POWER_HELPER' . $this->hhh] = ''; + $this->fileContentStatic[$this->hhh . 'SITE_POWER_HELPER' . $this->hhh] = ''; // infuse powers data if set - if (ComponentbuilderHelper::checkArray($this->powers)) + if (ArrayHelper::check($this->powers)) { // start the autoloader $autoloader = array(); foreach ($this->powers as $power) { - if (ComponentbuilderHelper::checkObject($power)) + if (ObjectHelper::check($power)) { // Trigger Event: jcb_ce_onBeforeInfusePowerData $this->triggerEvent( @@ -2349,11 +2351,11 @@ class Infusion extends Interpretation $_backup_lang = $this->lang; $_backup_langPrefix = $this->langPrefix; // infuse module data if set - if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + if (ArrayHelper::check($this->joomlaModules)) { foreach ($this->joomlaModules as $module) { - if (ComponentbuilderHelper::checkObject($module)) + if (ObjectHelper::check($module)) { // Trigger Event: jcb_ce_onBeforeInfuseModuleData $this->triggerEvent( @@ -2394,7 +2396,7 @@ class Infusion extends Interpretation } // FIELDSET if (isset($module->form_files) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $module->form_files )) { @@ -2428,11 +2430,11 @@ class Infusion extends Interpretation } } // infuse plugin data if set - if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) + if (ArrayHelper::check($this->joomlaPlugins)) { foreach ($this->joomlaPlugins as $plugin) { - if (ComponentbuilderHelper::checkObject($plugin)) + if (ObjectHelper::check($plugin)) { // Trigger Event: jcb_ce_onBeforeInfusePluginData $this->triggerEvent( @@ -2456,7 +2458,7 @@ class Infusion extends Interpretation } // FIELDSET if (isset($plugin->form_files) - && ComponentbuilderHelper::checkArray( + && ArrayHelper::check( $plugin->form_files )) { @@ -2524,10 +2526,10 @@ class Infusion extends Interpretation { // set main keys $nameSingleCode = $view->name_single_code; - $name_single_uppercase = ComponentbuilderHelper::safeString( + $name_single_uppercase = StringHelper::safe( $view->name_single, 'U' ); - $name_single_first_uppercase = ComponentbuilderHelper::safeString( + $name_single_first_uppercase = StringHelper::safe( $view->name_single, 'F' ); @@ -2550,10 +2552,10 @@ class Infusion extends Interpretation if (isset($view->name_list) && $view->name_list != 'null') { $nameListCode = $view->name_list_code; - $name_list_uppercase = ComponentbuilderHelper::safeString( + $name_list_uppercase = StringHelper::safe( $view->name_list, 'U' ); - $name_list_first_uppercase = ComponentbuilderHelper::safeString( + $name_list_first_uppercase = StringHelper::safe( $view->name_list, 'F' ); @@ -2683,7 +2685,7 @@ class Infusion extends Interpretation $this->languages['components'][$this->langTag]['sitesys'] ); } - $values = array_unique(ComponentbuilderHelper::mergeArrays($values)); + $values = array_unique(ArrayHelper::merge($values)); // get the other lang strings if there is any $this->multiLangString = $this->getMultiLangStrings($values); // update insert the current lang in to DB @@ -2699,7 +2701,7 @@ class Infusion extends Interpretation &$this->langTag) ); // now we insert the values into the files - if (ComponentbuilderHelper::checkArray($this->languages['components'])) + if (ArrayHelper::check($this->languages['components'])) { // rest xml array $langXML = array(); @@ -2775,18 +2777,18 @@ class Infusion extends Interpretation } } // load the lang xml - if (ComponentbuilderHelper::checkArray($langXML)) + if (ArrayHelper::check($langXML)) { $replace = array(); if (isset($langXML['admin']) - && ComponentbuilderHelper::checkArray($langXML['admin'])) + && ArrayHelper::check($langXML['admin'])) { $replace[$this->hhh . 'ADMIN_LANGUAGES' . $this->hhh] = implode(PHP_EOL . $this->_t(3), $langXML['admin']); } if ((!$this->removeSiteFolder || !$this->removeSiteEditFolder) && isset($langXML['site']) - && ComponentbuilderHelper::checkArray($langXML['site'])) + && ArrayHelper::check($langXML['site'])) { $replace[$this->hhh . 'SITE_LANGUAGES' . $this->hhh] = implode(PHP_EOL . $this->_t(2), $langXML['site']); @@ -2795,7 +2797,7 @@ class Infusion extends Interpretation $xmlPath = $this->componentPath . '/' . $this->componentCodeName . '.xml'; // get the content in xml - $componentXML = ComponentbuilderHelper::getFileContents( + $componentXML = FileHelper::getContent( $xmlPath ); // update the xml content diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 462a4bc60..eee9785e6 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -13,6 +13,50 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); + +// register this component namespace +spl_autoload_register(function ($class) { + // project-specific base directories and namespace prefix + $search = array( + 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' + ); + // Start the search and load if found + $found = false; + $found_base_dir = ""; + $found_len = 0; + foreach ($search as $base_dir => $prefix) + { + // does the class use the namespace prefix? + $len = strlen($prefix); + if (strncmp($prefix, $class, $len) === 0) + { + // we have a match so load the values + $found = true; + $found_base_dir = $base_dir; + $found_len = $len; + // done here + break; + } + } + // check if we found a match + if (!$found) + { + // no, move to the next registered autoloader + return; + } + // get the relative class name + $relative_class = substr($class, $found_len); + // replace the namespace prefix with the base directory, replace namespace + // separators with directory separators in the relative class name, append + // with .php + $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); + use Joomla\CMS\Language\Language; use Joomla\Registry\Registry; use Joomla\String\StringHelper; @@ -24,12 +68,20 @@ use Joomla\Archive\Archive; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Filesystem\Path; +use VDM\Joomla\Utilities; /** * Componentbuilder component helper. */ abstract class ComponentbuilderHelper { + /** + * Adding the utilities trait to this class + * + * @deprecated 4.0 - Check the trait methods for details, a legacy implementation + */ + use Utilities; + /** * Composer Switch * @@ -37,13 +89,6 @@ abstract class ComponentbuilderHelper */ protected static $composer = array(); - /** - * The Main Active Language - * - * @var string - */ - public static $langTag; - /** * The Global Admin Event Method. **/ @@ -665,157 +710,6 @@ abstract class ComponentbuilderHelper } } - /** - * Making class or function name safe - * - * @input string The name you would like to make safe - * - * @returns string on success - **/ - public static function safeClassFunctionName($name) - { - // remove numbers if the first character is a number - if (is_numeric(substr($name, 0, 1))) - { - $name = self::replaceNumbers($name); - } - // remove all spaces and strange characters - return trim(preg_replace("/[^A-Za-z0-9_-]/", '', $name)); - } - - /** - * The field builder switch - **/ - protected static $fieldNameBuilder = false; - - /** - * Making field names safe - * - * @input string The you would like to make safe - * @input boolean The switch to return an ALL UPPER CASE string - * @input string The string to use in white space - * - * @returns string on success - **/ - public static function safeFieldName($string, $allcap = false, $spacer = '_') - { - // get global value - if (self::$fieldNameBuilder === false) - { - self::$fieldNameBuilder = JComponentHelper::getParams('com_componentbuilder')->get('field_name_builder', 1); - } - // use the new convention - if (2 == self::$fieldNameBuilder) - { - // 0nly continue if we have a string - if (self::checkString($string)) - { - // check that the first character is not a number - if (is_numeric(substr($string, 0, 1))) - { - $string = self::replaceNumbers($string); - } - // remove all other strange characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters and numbers - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - // replace white space with underscore (SAFEST OPTION) - $string = preg_replace('/\s+/', $spacer, $string); - // return all caps - if ($allcap) - { - return strtoupper($string); - } - // default is to return lower - return strtolower($string); - } - // not a string - return ''; - } - // return all caps - if ($allcap) - { - return self::safeString($string, 'U'); - } - // use the default (original behaviour/convention) - return self::safeString($string); - } - - /** - * The type builder switch - **/ - protected static $typeNameBuilder = false; - - /** - * Making field type name safe - * - * @input string The you would like to make safe - * - * @returns string on success - **/ - public static function safeTypeName($string) - { - // get global value - if (self::$typeNameBuilder === false) - { - self::$typeNameBuilder = JComponentHelper::getParams('com_componentbuilder')->get('type_name_builder', 1); - } - // use the new convention - if (2 == self::$typeNameBuilder) - { - // 0nly continue if we have a string - if (self::checkString($string)) - { - // check that the first character is not a number - if (is_numeric(substr($string, 0, 1))) - { - $string = self::replaceNumbers($string); - } - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters and numbers and point (TODO just one point) - $string = trim(preg_replace("/[^A-Za-z0-9\.]/", '', $string)); - // best is to return lower (for all string equality in compiler) - return strtolower($string); - } - // not a string - return ''; - } - // use the default (original behaviour/convention) - return self::safeString($string); - } - - /** - * Making namespace safe - * - * @input string The you would like to make safe - * - * @returns string on success - **/ - public static function safeNamespace($string) - { - // 0nly continue if we have a string - if (self::checkString($string)) - { - // make sure it has not numbers - $string = self::replaceNumbers($string); - // Transliterate string TODO: look again as this make it lowercase - // $string = self::transliterate($string); - // first remove all [\] backslashes - $string = str_replace('\\', '1', $string); - // remove all and keep only characters and [\] backslashes inside of the string - $string = trim(preg_replace("/[^A-Za-z1]/", '', $string), '1'); - // place the [\] backslashes back - return trim(preg_replace("/1+/", '\\', $string)); - } - // not a string - return ''; - } - /* * Get the Array of Existing Validation Rule Names * @@ -1134,51 +1028,6 @@ abstract class ComponentbuilderHelper } } - /** - * get all the file paths in folder and sub folders - * - * @param string $folder The local path to parse - * @param array $fileTypes The type of files to get - * - * @return void - * - */ - public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true) - { - if (Folder::exists($folder)) - { - // we must first store the current woking directory - $joomla = getcwd(); - // we are changing the working directory to the component path - chdir($folder); - // make sure we have file type filter - if (self::checkArray($fileTypes)) - { - // get the files - foreach ($fileTypes as $type) - { - // get a list of files in the current directory tree - $files[] = Folder::files('.', $type, $recurse, $full); - } - } - elseif (self::checkString($fileTypes)) - { - // get a list of files in the current directory tree - $files[] = Folder::files('.', $fileTypes, $recurse, $full); - } - else - { - // get a list of files in the current directory tree - $files[] = Folder::files('.', '.', $recurse, $full); - } - // change back to Joomla working directory - chdir($joomla); - // return array of files - return array_map( function($file) { return str_replace('./', '/', $file); }, (array) self::mergeArrays($files)); - } - return false; - } - /** * get all component IDs */ @@ -2276,172 +2125,6 @@ abstract class ComponentbuilderHelper return $default; } - /** - * Returns a GUIDv4 string - * - * Thanks to Dave Pearson (and other) - * https://www.php.net/manual/en/function.com-create-guid.php#119168 - * - * Uses the best cryptographically secure method - * for all supported platforms with fallback to an older, - * less secure version. - * - * @param bool $trim - * @return string - */ - public static function GUID ($trim = true) - { - // Windows - if (function_exists('com_create_guid') === true) - { - if ($trim === true) - { - return trim(com_create_guid(), '{}'); - } - return com_create_guid(); - } - - // set the braces if needed - $lbrace = $trim ? "" : chr(123); // "{" - $rbrace = $trim ? "" : chr(125); // "}" - - // OSX/Linux - if (function_exists('openssl_random_pseudo_bytes') === true) - { - $data = openssl_random_pseudo_bytes(16); - $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 - $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 - return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace; - } - - // Fallback (PHP 4.2+) - mt_srand((double)microtime() * 10000); - $charid = strtolower(md5(uniqid(rand(), true))); - $hyphen = chr(45); // "-" - $guidv4 = $lbrace. - substr($charid, 0, 8).$hyphen. - substr($charid, 8, 4).$hyphen. - substr($charid, 12, 4).$hyphen. - substr($charid, 16, 4).$hyphen. - substr($charid, 20, 12). - $rbrace; - return $guidv4; - } - - /** - * Validate the Globally Unique Identifier ( and check if table already has this identifier) - * - * @param string $guid - * @param string $table - * @param int $id - * @return bool - */ - public static function validGUID ($guid, $table = null, $id = 0) - { - // check if we have a string - if (self::validateGUID($guid)) - { - // check if table already has this identifier - if (self::checkString($table)) - { - // Get the database object and a new query object. - $db = \JFactory::getDbo(); - $query = $db->getQuery(true); - $query->select('COUNT(*)') - ->from('#__componentbuilder_' . (string) $table) - ->where($db->quoteName('guid') . ' = ' . $db->quote($guid)); - - // remove this item from the list - if ($id > 0) - { - $query->where($db->quoteName('id') . ' <> ' . (int) $id); - } - - // Set and query the database. - $db->setQuery($query); - $duplicate = (bool) $db->loadResult(); - - if ($duplicate) - { - return false; - } - } - return true; - } - return false; - } - - /** - * get the ITEM of a GUID by table - * - * @param string $guid - * @param string $table - * @param string/array $what - * - * @return mix - */ - public static function getGUID ($guid, $table, $what = 'a.id') - { - // check if we have a string - if (self::validateGUID($guid)) - { - // check if table already has this identifier - if (self::checkString($table)) - { - // Get the database object and a new query object. - $db = \JFactory::getDbo(); - $query = $db->getQuery(true); - if (self::checkArray($what)) - { - $query->select($db->quoteName($what)); - } - else - { - $query->select($what); - } - $query->from($db->quoteName('#__componentbuilder_' . (string) $table, 'a')) - ->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid)); - - // Set and query the database. - $db->setQuery($query); - $db->execute(); - - if ($db->getNumRows()) - { - if (self::checkArray($what) || $what === 'a.*') - { - return $db->loadObject(); - } - else - { - return $db->loadResult(); - } - } - } - } - return false; - } - - /** - * Validate the Globally Unique Identifier - * - * Thanks to Lewie - * https://stackoverflow.com/a/1515456/1429677 - * - * @param string $guid - * @return bool - */ - protected static function validateGUID ($guid) - { - // check if we have a string - if (self::checkString($guid)) - { - return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $guid); - } - return false; - } - - /** * Tab/spacer bucket (to speed-up the build) * @@ -2800,91 +2483,6 @@ abstract class ComponentbuilderHelper } - /** - * The zipper method - * - * @param string $workingDIR The directory where the items must be zipped - * @param string $filepath The path to where the zip file must be placed - * - * @return bool true On success - * - */ - public static function zip($workingDIR, &$filepath) - { - // store the current joomla working directory - $joomla = getcwd(); - - // we are changing the working directory to the component temp folder - chdir($workingDIR); - - // the full file path of the zip file - $filepath = Path::clean($filepath); - - // delete an existing zip file (or use an exclusion parameter in Folder::files() - File::delete($filepath); - - // get a list of files in the current directory tree - $files = Folder::files('.', '', true, true); - $zipArray = array(); - // setup the zip array - foreach ($files as $file) - { - $tmp = array(); - $tmp['name'] = str_replace('./', '', $file); - $tmp['data'] = self::getFileContents($file); - $tmp['time'] = filemtime($file); - $zipArray[] = $tmp; - } - - // change back to joomla working directory - chdir($joomla); - - // get the zip adapter - $adapter = new Archive(); - $zip = $adapter->getAdapter('zip'); - - //create the zip file - if ($zip->create($filepath, $zipArray)) - { - return true; - } - return false; - } - - - /** - * Write a file to the server - * - * @param string $path The path and file name where to safe the data - * @param string $data The data to safe - * - * @return bool true On success - * - */ - public static function writeFile($path, $data) - { - $klaar = false; - if (self::checkString($data)) - { - // open the file - $fh = fopen($path, "w"); - if (!is_resource($fh)) - { - return $klaar; - } - // write to the file - if (fwrite($fh, $data)) - { - // has been done - $klaar = true; - } - // close file. - fclose($fh); - } - return $klaar; - } - - /** * Remove folders with files * @@ -3913,70 +3511,6 @@ abstract class ComponentbuilderHelper return false; } - /** - * get between - * - * @param string $content The content to search - * @param string $start The starting value - * @param string $end The ending value - * @param string $default The default value if none found - * - * @return string On success / empty string on failure - * - */ - public static function getBetween($content, $start, $end, $default = '') - { - $r = explode($start, $content); - if (isset($r[1])) - { - $r = explode($end, $r[1]); - return $r[0]; - } - return $default; - } - - /** - * get all between - * - * @param string $content The content to search - * @param string $start The starting value - * @param string $end The ending value - * - * @return array On success - * - */ - public static function getAllBetween($content, $start, $end) - { - // reset bucket - $bucket = array(); - for ($i = 0; ; $i++) - { - // search for string - $found = self::getBetween($content,$start,$end); - if (self::checkString($found)) - { - // add to bucket - $bucket[] = $found; - // build removal string - $remove = $start.$found.$end; - // remove from content - $content = str_replace($remove,'',$content); - } - else - { - break; - } - // safety catch - if ($i == 500) - { - break; - } - } - // only return unique array of values - return array_unique($bucket); - } - - /** * Field Grouping https://docs.joomla.org/Form_field **/ @@ -4209,81 +3743,6 @@ abstract class ComponentbuilderHelper return $exists; } - /** - * Get the file path or url - * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $fileType The kind of filename to generate (if not set no file name is generated) - * @param string $key The key to adjust the filename (if not set ignored) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found - * - * @return string On success the path or url is returned based on the type requested - * - */ - public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) - { - // make sure to always have a string/path - if(!self::checkString($default)) - { - $default = JPATH_SITE . '/images/'; - } - // get the global settings - if (!self::checkObject(self::$params)) - { - self::$params = JComponentHelper::getParams('com_componentbuilder'); - } - $filePath = self::$params->get($target, $default); - // check the file path (revert to default only of not a hidden file path) - if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false) - { - $filePath = $default; - } - // create the folder if it does not exist - if ($createIfNotSet && !Folder::exists($filePath)) - { - Folder::create($filePath); - } - // setup the file name - $fileName = ''; - // Get basic key - $basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug'; - if (method_exists(get_called_class(), "getCryptKey")) - { - $basickey = self::getCryptKey('basic', $basickey); - } - // check the key - if (!self::checkString($key)) - { - $key = 'vDm'; - } - // set the file name - if (self::checkString($fileType)) - { - // set the name - $fileName = trim(md5($type.$target.$basickey.$key) . '.' . trim($fileType, '.')); - } - else - { - $fileName = trim(md5($type.$target.$basickey.$key)) . '.txt'; - } - // return the url - if ('url' === $type) - { - if (strpos($filePath, JPATH_SITE) !== false) - { - $filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/'); - return JURI::root() . $filePath . '/' . $fileName; - } - // since the path is behind the root folder of the site, return only the root url (may be used to build the link) - return JURI::root(); - } - // sanitize the path - return '/' . trim( $filePath, '/' ) . '/' . $fileName; - } - - /** * Get the file path or url * @@ -4329,59 +3788,6 @@ abstract class ComponentbuilderHelper } - /** - * get the content of a file - * - * @param string $path The path to the file - * @param string/bool $none The return value if no content was found - * - * @return string On success - * - */ - public static function getFileContents($path, $none = '') - { - if (self::checkString($path)) - { - // use basic file get content for now - if (($content = @file_get_contents($path)) !== FALSE) - { - return $content; - } - // use curl if available - elseif (function_exists('curl_version')) - { - // start curl - $ch = curl_init(); - // set the options - $options = array(); - $options[CURLOPT_URL] = $path; - $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; - $options[CURLOPT_RETURNTRANSFER] = TRUE; - $options[CURLOPT_SSL_VERIFYPEER] = FALSE; - // load the options - curl_setopt_array($ch, $options); - // get the content - $content = curl_exec($ch); - // close the connection - curl_close($ch); - // return if found - if (self::checkString($content)) - { - return $content; - } - } - elseif (property_exists('ComponentbuilderHelper', 'curlErrorLoaded') && !self::$curlErrorLoaded) - { - // set the notice - JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); - // load this notice only once - self::$curlErrorLoaded = true; - } - } - return $none; - } - - /** * the Crypt objects **/ @@ -4917,85 +4323,6 @@ abstract class ComponentbuilderHelper } - /** - * bc math wrapper (very basic not for accounting) - * - * @param string $type The type bc math - * @param int $val1 The first value - * @param int $val2 The second value - * @param int $scale The scale value - * - * @return int - * - */ - public static function bcmath($type, $val1, $val2, $scale = 0) - { - // build function name - $function = 'bc' . $type; - // use the bcmath function if available - if (function_exists($function)) - { - return $function($val1, $val2, $scale); - } - // if function does not exist we use +-*/ operators (fallback - not ideal) - switch ($type) - { - // Multiply two numbers - case 'mul': - return (string) round($val1 * $val2, $scale); - break; - // Divide of two numbers - case 'div': - return (string) round($val1 / $val2, $scale); - break; - // Adding two numbers - case 'add': - return (string) round($val1 + $val2, $scale); - break; - // Subtract one number from the other - case 'sub': - return (string) round($val1 - $val2, $scale); - break; - // Raise an arbitrary precision number to another - case 'pow': - return (string) round(pow($val1, $val2), $scale); - break; - // Compare two arbitrary precision numbers - case 'comp': - return (round($val1,2) == round($val2,2)); - break; - } - return false; - } - - /** - * Basic sum of an array with more precision - * - * @param array $array The values to sum - * @param int $scale The scale value - * - * @return float - * - */ - public static function bcsum($array, $scale = 4) - { - // use the bcadd function if available - if (function_exists('bcadd')) - { - // set the start value - $value = 0.0; - // loop the values and run bcadd - foreach($array as $val) - { - $value = bcadd($value, $val, $scale); - } - return $value; - } - // fall back on array sum - return array_sum($array); - } - - /** * the locker * @@ -7436,177 +6763,6 @@ abstract class ComponentbuilderHelper return true; } - /** - * 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 - * - */ - public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder') - { - if(!$where) - { - $where = JFactory::getUser()->id; - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#__'.$main.'_'.$table)); - } - if (is_numeric($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); - } - elseif (is_string($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); - } - else - { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); - } - return false; - } - - /** - * 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 - * - */ - public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true) - { - if(!$where) - { - $where = JFactory::getUser()->id; - } - - if (!self::checkArray($where) && $where > 0) - { - $where = array($where); - } - - if (self::checkArray($where)) - { - // prep main <-- why? well if $main='' is empty then $table can be categories or users - if (self::checkString($main)) - { - $main = '_'.ltrim($main, '_'); - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#_'.$main.'_'.$table)); - } - // add strings to array search - if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) - { - $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); - } - else - { - $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - if ($unique) - { - return array_unique($db->loadColumn()); - } - return $db->loadColumn(); - } - } - return false; - } - - public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') - { - // do some table foot work - $external = false; - if (strpos($table, '#__') !== false) - { - $external = true; - $table = str_replace('#__', '', $table); - } - // check if string is JSON - $result = json_decode($value, true); - if (json_last_error() === JSON_ERROR_NONE) - { - // is JSON - if (self::checkArray($result)) - { - if (self::checkString($table)) - { - $names = array(); - foreach ($result as $val) - { - if ($external) - { - if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) - { - $names[] = $_name; - } - } - else - { - if ($_name = self::getVar($table, $val, $id, $name)) - { - $names[] = $_name; - } - } - } - if (self::checkArray($names)) - { - return (string) implode($sperator,$names); - } - } - return (string) implode($sperator,$result); - } - return (string) json_decode($value); - } - return $value; - } - public static function isPublished($id,$type) { if ($type == 'raw') @@ -8200,83 +7356,6 @@ abstract class ComponentbuilderHelper return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; } - /** - * Check if have an json string - * - * @input string The json string to check - * - * @returns bool true on success - */ - public static function checkJson($string) - { - if (self::checkString($string)) - { - json_decode($string); - return (json_last_error() === JSON_ERROR_NONE); - } - return false; - } - - /** - * Check if have an object with a length - * - * @input object The object to check - * - * @returns bool true on success - */ - public static function checkObject($object) - { - if (isset($object) && is_object($object)) - { - return count((array)$object) > 0; - } - return false; - } - - /** - * Check if have an array with a length - * - * @input array The array to check - * - * @returns bool/int number of items in array on success - */ - public static function checkArray($array, $removeEmptyString = false) - { - if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) - { - // also make sure the empty strings are removed - if ($removeEmptyString) - { - foreach ($array as $key => $string) - { - if (empty($string)) - { - unset($array[$key]); - } - } - return self::checkArray($array, false); - } - return $nr; - } - return false; - } - - /** - * Check if have a string with a length - * - * @input string The string to check - * - * @returns bool true on success - */ - public static function checkString($string) - { - if (isset($string) && is_string($string) && strlen($string) > 0) - { - return true; - } - return false; - } - /** * Check if we are connected * Thanks https://stackoverflow.com/a/4860432/1429677 @@ -8302,345 +7381,12 @@ abstract class ComponentbuilderHelper return $is_conn; } - /** - * Merge an array of array's - * - * @input array The arrays you would like to merge - * - * @returns array on success - */ - public static function mergeArrays($arrays) - { - if(self::checkArray($arrays)) - { - $arrayBuket = array(); - foreach ($arrays as $array) - { - if (self::checkArray($array)) - { - $arrayBuket = array_merge($arrayBuket, $array); - } - } - return $arrayBuket; - } - return false; - } - // 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 - */ - public static function shorten($string, $length = 40, $addTip = true) - { - if (self::checkString($string)) - { - $initial = strlen($string); - $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); - $words_count = count((array)$words); - - $word_length = 0; - $last_word = 0; - for (; $last_word < $words_count; ++$last_word) - { - $word_length += strlen($words[$last_word]); - if ($word_length > $length) - { - break; - } - } - - $newString = implode(array_slice($words, 0, $last_word)); - $final = strlen($newString); - if ($initial != $final && $addTip) - { - $title = self::shorten($string, 400 , false); - return ''.trim($newString).'...'; - } - elseif ($initial != $final && !$addTip) - { - return trim($newString).'...'; - } - } - return $string; - } - - /** - * Making strings safe (various ways) - * - * @input string The you would like to make safe - * - * @returns string on success - */ - public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) - { - if ($replaceNumbers === true) - { - // remove all numbers and replace with english text version (works well only up to millions) - $string = self::replaceNumbers($string); - } - // 0nly continue if we have a string - if (self::checkString($string)) - { - // create file name without the extention that is safe - if ($type === 'filename') - { - // make sure VDM is not in the string - $string = str_replace('VDM', 'vDm', $string); - // Remove anything which isn't a word, whitespace, number - // or any of the following caracters -_() - // If you don't need to handle multi-byte characters - // you can use preg_replace rather than mb_ereg_replace - // Thanks @Łukasz Rysiak! - // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); - $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); - // http://stackoverflow.com/a/2021729/1429677 - return preg_replace('/\s+/', ' ', $string); - } - // remove all other characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters - if ($keepOnlyCharacters) - { - $string = preg_replace("/[^A-Za-z ]/", '', $string); - } - // keep both numbers and characters - else - { - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - } - // select final adaptations - if ($type === 'L' || $type === 'strtolower') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // default is to return lower - return strtolower($string); - } - elseif ($type === 'W') - { - // return a string with all first letter of each word uppercase(no undersocre) - return ucwords(strtolower($string)); - } - elseif ($type === 'w' || $type === 'word') - { - // return a string with all lowercase(no undersocre) - return strtolower($string); - } - elseif ($type === 'Ww' || $type === 'Word') - { - // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) - return ucfirst(strtolower($string)); - } - elseif ($type === 'WW' || $type === 'WORD') - { - // return a string with all the uppercase(no undersocre) - return strtoupper($string); - } - elseif ($type === 'U' || $type === 'strtoupper') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return all upper - return strtoupper($string); - } - elseif ($type === 'F' || $type === 'ucfirst') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return with first caracter to upper - return ucfirst(strtolower($string)); - } - elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') - { - // convert all words to first letter uppercase - $string = ucwords(strtolower($string)); - // remove white space - $string = preg_replace('/\s+/', '', $string); - // now return first letter lowercase - return lcfirst($string); - } - // return string - return $string; - } - // not a string - return ''; - } - - public static function transliterate($string) - { - // set tag only once - if (!self::checkString(self::$langTag)) - { - // get global value - self::$langTag = JComponentHelper::getParams('com_componentbuilder')->get('language', 'en-GB'); - } - // Transliterate on the language requested - $lang = Language::getInstance(self::$langTag); - return $lang->transliterate($string); - } - - public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) - { - if (self::checkString($var)) - { - $filter = new JFilterInput(); - $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); - if ($shorten) - { - return self::shorten($string,$length); - } - return $string; - } - else - { - return ''; - } - } - - public static function replaceNumbers($string) - { - // set numbers array - $numbers = array(); - // first get all numbers - preg_match_all('!\d+!', $string, $numbers); - // check if we have any numbers - if (isset($numbers[0]) && self::checkArray($numbers[0])) - { - foreach ($numbers[0] as $number) - { - $searchReplace[$number] = self::numberToString((int)$number); - } - // now replace numbers in string - $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); - // check if we missed any, strange if we did. - return self::replaceNumbers($string); - } - // return the string with no numbers remaining. - return $string; - } - - /** - * Convert an integer into an English word string - * Thanks to Tom Nicholson - * - * @input an int - * @returns a string - */ - public static function numberToString($x) - { - $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", - "eight", "nine", "ten", "eleven", "twelve", "thirteen", - "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", - "nineteen", "twenty", 30 => "thirty", 40 => "forty", - 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", - 90 => "ninety" ); - - if(!is_numeric($x)) - { - $w = $x; - } - elseif(fmod($x, 1) != 0) - { - $w = $x; - } - else - { - if($x < 0) - { - $w = 'minus '; - $x = -$x; - } - else - { - $w = ''; - // ... now $x is a non-negative integer. - } - - if($x < 21) // 0 to 20 - { - $w .= $nwords[$x]; - } - elseif($x < 100) // 21 to 99 - { - $w .= $nwords[10 * floor($x/10)]; - $r = fmod($x, 10); - if($r > 0) - { - $w .= ' '. $nwords[$r]; - } - } - elseif($x < 1000) // 100 to 999 - { - $w .= $nwords[floor($x/100)] .' hundred'; - $r = fmod($x, 100); - if($r > 0) - { - $w .= ' and '. self::numberToString($r); - } - } - elseif($x < 1000000) // 1000 to 999999 - { - $w .= self::numberToString(floor($x/1000)) .' thousand'; - $r = fmod($x, 1000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - else // millions - { - $w .= self::numberToString(floor($x/1000000)) .' million'; - $r = fmod($x, 1000000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - } - return $w; - } - - /** - * Random Key - * - * @returns a string - */ - public static function randomkey($size) - { - $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; - $key = array(); - $bagsize = strlen($bag) - 1; - for ($i = 0; $i < $size; $i++) - { - $get = rand(0, $bagsize); - $key[] = $bag[$get]; - } - return implode($key); - } - /** * Get The Encryption Keys * diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 5625683e4..eff098d0c 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -3950,10 +3950,10 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NEW_TAB="New Tab" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NEW_TAB_2="New Tab 2" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NEXT="Next" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO="No" -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?= JText::_('Text') ?>
-<?= JText::sprintf('Hello %s', $this->user->name) ?>
+COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
+<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
Just get UPPERCASE language string:
-<?= JustTEXT::_('Text') ?>" +<?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_LIBRARIES_SELECTION_DESCRIPTION="All libraries you select will dynamically be added to the header of the page according to the settings of the selected library. Each library will also get its respective buttons added to the component global options if it has any set. Please take a look at the libraries for more details." COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_LIBRARIES_SELECTION_LABEL="Select libraries you would like to use in your code" @@ -6237,7 +6237,11 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNFEATURED_1="%s Joomla Modu COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNPUBLISHED="%s Joomla Modules Updates unpublished." COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Joomla Module Updates unpublished." COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS="abstract class" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_DESCRIPTION="Set other field path" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_LABEL="Other Field Path" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME_LABEL="Add README" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_DESCRIPTION="Set other rule path" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_LABEL="Other Rule Path" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_DESCRIPTION="You can add a helper class to your module." COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_DESCRIPTION="You can add your own custom helper header script." COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_LABEL="Add Class Helper Header" @@ -6439,10 +6443,10 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_JOOMLA_MODULE_NEW="A New Joomla Module" COM_COMPONENTBUILDER_JOOMLA_MODULE_NO="No" COM_COMPONENTBUILDER_JOOMLA_MODULE_NONE="None" -COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?= JText::_('Text') ?>
-<?= JText::sprintf('Hello %s', $this->user->name) ?>
+COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
+<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
Just get UPPERCASE language string:
-<?= JustTEXT::_('Text') ?>" +<?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_DESCRIPTION="

All libraries added to modules are added to the component media folder for now

So over here you are able to manually add HTML code to your model default tmpl.

" @@ -6462,6 +6466,8 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_UPDATE_SERVER_NOTE_ZIP_LABEL="The ZIP Op COM_COMPONENTBUILDER_JOOMLA_MODULE_NOT_REQUIRED="Not Required" COM_COMPONENTBUILDER_JOOMLA_MODULE_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_JOOMLA_MODULE_OTHER="Other" +COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_LABEL="Path" +COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_MESSAGE="Error! Please add extra field path here." COM_COMPONENTBUILDER_JOOMLA_MODULE_PERMISSION="Permissions" COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_METHOD_UNINSTALL_DESCRIPTION="PHP script that should run during uninstall." COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_METHOD_UNINSTALL_LABEL="PHP Method (uninstall)" @@ -6680,7 +6686,11 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNFEATURED="%s Joomla Plugin COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNFEATURED_1="%s Joomla Plugin Updates unfeatured." COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNPUBLISHED="%s Joomla Plugins Updates unpublished." COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Joomla Plugin Updates unpublished." +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_DESCRIPTION="Set other field path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_LABEL="Other Field Path" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDREADME_LABEL="Add README" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_DESCRIPTION="Set other rule path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_LABEL="Other Rule Path" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_DESCRIPTION="You can add your own custom header script, combined with the default header script that make the extended class work." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_LABEL="Add Custom Class Header" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP Method (uninstall)" @@ -6935,6 +6945,8 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_UPDATE_SERVER_NOTE_ZIP_LABEL="The ZIP Op COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOT_REQUIRED="Not Required" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_OTHER="Other" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_LABEL="Path" +COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_MESSAGE="Error! Please add extra field path here." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PERMISSION="Permissions" COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_DESCRIPTION="PHP script that should run during uninstall." COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_LABEL="PHP Method (uninstall)" @@ -7285,10 +7297,10 @@ COM_COMPONENTBUILDER_LAYOUT_NAME_LABEL="Name" COM_COMPONENTBUILDER_LAYOUT_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_LAYOUT_NEW="A New Layout" COM_COMPONENTBUILDER_LAYOUT_NO="No" -COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?= JText::_('Text') ?>
-<?= JText::sprintf('Hello %s', $this->user->name) ?>
+COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
+<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
Just get UPPERCASE language string:
-<?= JustTEXT::_('Text') ?>" +<?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_LAYOUT_NOTE_LIBRARIES_SELECTION_DESCRIPTION="All libraries you select will dynamically be added to the header of the page according to the settings of the selected library. Each library will also get its respective buttons added to the component global options if it has any set. Please take a look at the libraries for more details." COM_COMPONENTBUILDER_LAYOUT_NOTE_LIBRARIES_SELECTION_LABEL="Select libraries you would like to use in your code" @@ -8381,10 +8393,10 @@ COM_COMPONENTBUILDER_SITE_VIEW_NEW_TAB_2="New Tab 2" COM_COMPONENTBUILDER_SITE_VIEW_NEXT="Next" COM_COMPONENTBUILDER_SITE_VIEW_NO="No" COM_COMPONENTBUILDER_SITE_VIEW_NONE="None" -COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?= JText::_('Text') ?>
-<?= JText::sprintf('Hello %s', $this->user->name) ?>
+COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
+<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
Just get UPPERCASE language string:
-<?= JustTEXT::_('Text') ?>" +<?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_SITE_VIEW_NOTE_CUSTOM_TOOLBAR_PLACEHOLDER_DESCRIPTION="Use this placeholder in the body [[[SITE_TOOLBAR]]] to add the custom position of the toolbar." COM_COMPONENTBUILDER_SITE_VIEW_NOTE_LIBRARIES_SELECTION_DESCRIPTION="All libraries you select will dynamically be added to the header of the page according to the settings of the selected library. Each library will also get its respective buttons added to the component global options if it has any set. Please take a look at the libraries for more details." @@ -8855,10 +8867,10 @@ COM_COMPONENTBUILDER_TEMPLATE_NAME_LABEL="Name" COM_COMPONENTBUILDER_TEMPLATE_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_TEMPLATE_NEW="A New Template" COM_COMPONENTBUILDER_TEMPLATE_NO="No" -COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?= JText::_('Text') ?>
-<?= JText::sprintf('Hello %s', $this->user->name) ?>
+COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_PHP_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>
+<?php echo JText::sprintf('Hello %s', $this->user->name); ?>
Just get UPPERCASE language string:
-<?= JustTEXT::_('Text') ?>" +<?php echo JustTEXT::_('Text'); ?>" COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_PHP_LANGUAGE_STRING_LABEL="Add PHP Language String" COM_COMPONENTBUILDER_TEMPLATE_NOTE_LIBRARIES_SELECTION_DESCRIPTION="All libraries you select will dynamically be added to the header of the page according to the settings of the selected library. Each library will also get its respective buttons added to the component global options if it has any set. Please take a look at the libraries for more details." COM_COMPONENTBUILDER_TEMPLATE_NOTE_LIBRARIES_SELECTION_LABEL="Select libraries you would like to use in your code" diff --git a/admin/layouts/component_dashboard/dashboard_fullwidth.php b/admin/layouts/component_dashboard/dashboard_fullwidth.php index 49bfd713b..5a4a6f0c1 100644 --- a/admin/layouts/component_dashboard/dashboard_fullwidth.php +++ b/admin/layouts/component_dashboard/dashboard_fullwidth.php @@ -28,8 +28,8 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( 'note_php_dashboard_note', - 'dashboard_tab', - 'php_dashboard_methods' + 'php_dashboard_methods', + 'dashboard_tab' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index 7d1d56bf9..94314a6df 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -203,7 +203,7 @@ class ComponentbuilderModelAdmin_views extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -817,17 +817,19 @@ class ComponentbuilderModelAdmin_views extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_admin_view')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -842,7 +844,7 @@ class ComponentbuilderModelAdmin_views extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_admin_view'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/admins_custom_tabs.php b/admin/models/admins_custom_tabs.php index ae1ee5152..2cd0de01a 100644 --- a/admin/models/admins_custom_tabs.php +++ b/admin/models/admins_custom_tabs.php @@ -94,7 +94,7 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_admin_custom_tabs')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_admin_custom_tabs'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/admins_fields.php b/admin/models/admins_fields.php index 3827615f4..4630c9cd8 100644 --- a/admin/models/admins_fields.php +++ b/admin/models/admins_fields.php @@ -94,7 +94,7 @@ class ComponentbuilderModelAdmins_fields extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelAdmins_fields extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_admin_fields')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelAdmins_fields extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_admin_fields'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/admins_fields_conditions.php b/admin/models/admins_fields_conditions.php index 26dd6cf54..f588062a1 100644 --- a/admin/models/admins_fields_conditions.php +++ b/admin/models/admins_fields_conditions.php @@ -94,7 +94,7 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_admin_fields_conditions')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_admin_fields_conditions'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/admins_fields_relations.php b/admin/models/admins_fields_relations.php index d6a54b264..16491c625 100644 --- a/admin/models/admins_fields_relations.php +++ b/admin/models/admins_fields_relations.php @@ -94,7 +94,7 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_admin_fields_relations')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_admin_fields_relations'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 78657fe19..5d9ddab42 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1803,10 +1803,10 @@ class ComponentbuilderModelAjax extends JModelList $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.alias','a.template','b.name','a.dynamic_get'))); + $query->select($db->quoteName(array('a.id', 'a.alias', 'a.template', 'b.name', 'a.dynamic_get'))); $query->from($db->quoteName('#__componentbuilder_template', 'a')); $query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'b') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('a.dynamic_get') . ')'); - $query->where($db->quoteName('a.id') . ' != '.(int) $id); + $query->where($db->quoteName('a.id') . ' != '. (int) $id); $query->where($db->quoteName('a.published') . ' = 1'); // Reset the query using our newly populated query object. $db->setQuery($query); @@ -1839,10 +1839,10 @@ class ComponentbuilderModelAjax extends JModelList $templateString[] = "".$result->name." ".$editget."<?php echo \$this->loadTemplate('".ComponentbuilderHelper::safeString($result->alias)."'); ?> ".$edit.""; } // build the table - $table = '

'.JText::_('COM_COMPONENTBUILDER_TEMPLATE_CODE_SNIPPETS').'

'; - $table .= ''; - $table .= ''; - $table .= ''.implode("",$templateString)."
'.JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE').'
'.JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET').''.JText::_('COM_COMPONENTBUILDER_SNIPPET').'
"; + $table = '

' . JText::_('COM_COMPONENTBUILDER_TEMPLATE_CODE_SNIPPETS') . '

'; + $table .= ''; + $table .= ''; + $table .= '' . implode("", $templateString) . "
' . JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE') . '
' . JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET') . '' . JText::_('COM_COMPONENTBUILDER_SNIPPET') . '
"; } return $table; } @@ -1892,34 +1892,38 @@ class ComponentbuilderModelAjax extends JModelList switch ($result->gettype) { case 1: - // single - $layoutString[] = "".$result->name." ".$editget."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->item); ?> ".$edit.""; + // single + $layoutString[] = "" . $result->name . " " . $editget . "<?php echo JLayoutHelper::render('" . ComponentbuilderHelper::safeString($result->alias) . "', \$this->item); ?> " . $edit . ""; break; case 2: - // list - $layoutString[] = "".$result->name." ".$editget."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->items); ?> ".$edit.""; + // list + $layoutString[] = "" . $result->name . " " . $editget . "<?php echo JLayoutHelper::render('" . ComponentbuilderHelper::safeString($result->alias) . "', \$this->items); ?> " . $edit . ""; break; case 3: case 4: - // custom - $result->getcustom = ComponentbuilderHelper::safeString($result->getcustom); - if (substr($result->getcustom, 0, strlen('get')) == 'get') - { - $varName = substr($result->getcustom, strlen('get')); - } - else - { - $varName = $result->getcustom; - } - $layoutString[] = "".$result->name." ".$editget."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->".$varName."); ?> ".$edit.""; + // custom + $result->getcustom = ComponentbuilderHelper::safeString($result->getcustom); + if (substr($result->getcustom, 0, strlen('get')) == 'get') + { + $varName = substr($result->getcustom, strlen('get')); + } + else + { + $varName = $result->getcustom; + } + $layoutString[] = "" . $result->name . " " . $editget . "<?php echo JLayoutHelper::render('" . ComponentbuilderHelper::safeString($result->alias) . "', \$this->" . $varName . "); ?> " . $edit . ""; + break; + default: + // no get + $layoutString[] = "" . JText::_('COM_COMPONENTBUILDER_NONE_SELECTED') . "<?php echo JLayoutHelper::render('" . ComponentbuilderHelper::safeString($result->alias) . "', [?]); ?> " . $edit . ""; break; } } // build the table - $table = '

'.JText::_('COM_COMPONENTBUILDER_LAYOUT_CODE_SNIPPETS').'

'; - $table .= ''; - $table .= ''; - $table .= ''.implode("",$layoutString)."
'.JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE').'
'.JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET').''.JText::_('COM_COMPONENTBUILDER_SNIPPET').'
"; + $table = '

' . JText::_('COM_COMPONENTBUILDER_LAYOUT_CODE_SNIPPETS') . '

'; + $table .= ''; + $table .= ''; + $table .= '' . implode("",$layoutString) . "
' . JText::_('COM_COMPONENTBUILDER_TO_ADD_SIMPLY_COPY_AND_PAST_THE_SNIPPET_INTO_YOUR_CODE') . '
' . JText::_('COM_COMPONENTBUILDER_NAME_OF_DYNAMICGET') . '' . JText::_('COM_COMPONENTBUILDER_SNIPPET') . '
"; } return $table; } diff --git a/admin/models/class_extendings.php b/admin/models/class_extendings.php index 68251a878..4beb12da9 100644 --- a/admin/models/class_extendings.php +++ b/admin/models/class_extendings.php @@ -110,7 +110,7 @@ class ComponentbuilderModelClass_extendings extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -323,17 +323,19 @@ class ComponentbuilderModelClass_extendings extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_class_extends')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -348,7 +350,7 @@ class ComponentbuilderModelClass_extendings extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_class_extends'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/class_methods.php b/admin/models/class_methods.php index 646fc1b6d..6b3e5e79f 100644 --- a/admin/models/class_methods.php +++ b/admin/models/class_methods.php @@ -118,7 +118,7 @@ class ComponentbuilderModelClass_methods extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -502,17 +502,19 @@ class ComponentbuilderModelClass_methods extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_class_method')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -527,7 +529,7 @@ class ComponentbuilderModelClass_methods extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_class_method'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/class_properties.php b/admin/models/class_properties.php index cebbe41f7..5b1288dd8 100644 --- a/admin/models/class_properties.php +++ b/admin/models/class_properties.php @@ -118,7 +118,7 @@ class ComponentbuilderModelClass_properties extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -498,17 +498,19 @@ class ComponentbuilderModelClass_properties extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_class_property')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -523,7 +525,7 @@ class ComponentbuilderModelClass_properties extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_class_property'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/component_dashboard.php b/admin/models/component_dashboard.php index d7e2372d8..4ca14076a 100644 --- a/admin/models/component_dashboard.php +++ b/admin/models/component_dashboard.php @@ -31,8 +31,8 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin 'dashboard' => array( 'fullwidth' => array( 'note_php_dashboard_note', - 'dashboard_tab', - 'php_dashboard_methods' + 'php_dashboard_methods', + 'dashboard_tab' ), 'above' => array( 'joomla_component' diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index 25f89450e..066f62c12 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -423,7 +423,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList .append("

" + issue.title + "

") .append("\"@" ") .append("" + issue.user.login + " '.JText::_('COM_COMPONENTBUILDER_OPENED_THIS').' '.JText::_('COM_COMPONENTBUILDER_ISSUE').'-" + issue.number + " (" + timeago + ") ") - .append(marked(issue.body)) + .append(marked.parse(issue.body)) .append("'.JText::_('COM_COMPONENTBUILDER_RESPOND_TO_THIS_ISSUE_ON_GITHUB').'...
"); }); }); @@ -436,7 +436,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList .append("

" + issue.title + "

") .append("\"@" ") .append("" + issue.user.login + " '.JText::_('COM_COMPONENTBUILDER_OPENED').' '.JText::_('COM_COMPONENTBUILDER_ISSUE').'-" + issue.number + " (" + timeago + ")") - .append(marked(issue.body)) + .append(marked.parse(issue.body)) .append("'.JText::_('COM_COMPONENTBUILDER_REVIEW_THIS_ISSUE_ON_GITHUB').'...
"); }); }); @@ -475,7 +475,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList .append(activeNotice) .append("\"@" ") .append("" + tagrelease.author.login + " '.JText::_('COM_COMPONENTBUILDER_RELEASED_THIS').' " + tagrelease.tag_name+ " (" + timeago + ")") - .append(marked(tagrelease.body)) + .append(marked.parse(tagrelease.body)) .append(" " + tagrelease.assets[0].name + " (" + tagrelease.assets[0].download_count + ") ") .append("| '.JText::_('COM_COMPONENTBUILDER_OPEN_ON_GITHUB').'...
"); }); @@ -503,7 +503,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList jQuery(document).ready(function () { jQuery.get(gewiki) .success(function(wiki) { - jQuery("#wiki-md").html(marked(wiki)); + jQuery("#wiki-md").html(marked.parse(wiki)); }) .error(function(jqXHR, textStatus, errorThrown) { jQuery("#wiki-md").html("'.JText::_('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER').'"); @@ -527,7 +527,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList jQuery.get(noticeboard) .success(function(board) { if (board.length > 5) { - jQuery("#noticeboard-md").html(marked(board)); + jQuery("#noticeboard-md").html(marked.parse(board)); getIS(1,board).done(function(result) { if (result){ jQuery("#cpanel_tabTabs a").each(function() { @@ -599,7 +599,7 @@ jQuery(document).ready( function($) { jQuery.get(proboard) .success(function(board) { if (board.length > 5) { - jQuery("#proboard-md").html(marked(board)); + jQuery("#proboard-md").html(marked.parse(board)); } else { jQuery("#proboard-md").html("'.JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); } @@ -620,7 +620,7 @@ jQuery(document).ready( function($) { jQuery(document).ready(function () { jQuery.get(getreadme) .success(function(readme) { - jQuery("#readme-md").html(marked(readme)); + jQuery("#readme-md").html(marked.parse(readme)); }) .error(function(jqXHR, textStatus, errorThrown) { jQuery("#readme-md").html("'.JText::_('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER').'"); diff --git a/admin/models/components_admin_views.php b/admin/models/components_admin_views.php index 555516d82..75ec3e4bf 100644 --- a/admin/models/components_admin_views.php +++ b/admin/models/components_admin_views.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_admin_views extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_admin_views extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_admin_views')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_admin_views extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_admin_views'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_config.php b/admin/models/components_config.php index 81e03d419..e100e49c2 100644 --- a/admin/models/components_config.php +++ b/admin/models/components_config.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_config extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_config extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_config')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_config extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_config'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_custom_admin_menus.php b/admin/models/components_custom_admin_menus.php index c1ac0ed32..a05d26f6b 100644 --- a/admin/models/components_custom_admin_menus.php +++ b/admin/models/components_custom_admin_menus.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_custom_admin_menus')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_custom_admin_menus'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_custom_admin_views.php b/admin/models/components_custom_admin_views.php index 34617a0b8..38f60715a 100644 --- a/admin/models/components_custom_admin_views.php +++ b/admin/models/components_custom_admin_views.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_custom_admin_views')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_custom_admin_views'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_dashboard.php b/admin/models/components_dashboard.php index a79fa23d6..473551471 100644 --- a/admin/models/components_dashboard.php +++ b/admin/models/components_dashboard.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_dashboard extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_dashboard extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_dashboard')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_dashboard extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_dashboard'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_files_folders.php b/admin/models/components_files_folders.php index b7cadc84d..bd53f0406 100644 --- a/admin/models/components_files_folders.php +++ b/admin/models/components_files_folders.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_files_folders extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_files_folders extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_files_folders')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_files_folders extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_files_folders'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_modules.php b/admin/models/components_modules.php index 2112cb012..e035eb096 100644 --- a/admin/models/components_modules.php +++ b/admin/models/components_modules.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_modules extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_modules extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_modules')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_modules extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_modules'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_mysql_tweaks.php b/admin/models/components_mysql_tweaks.php index 55049c4cb..655fa1622 100644 --- a/admin/models/components_mysql_tweaks.php +++ b/admin/models/components_mysql_tweaks.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_mysql_tweaks')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_mysql_tweaks'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_placeholders.php b/admin/models/components_placeholders.php index 969cb62c8..98fdabbf6 100644 --- a/admin/models/components_placeholders.php +++ b/admin/models/components_placeholders.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_placeholders extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_placeholders extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_placeholders')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_placeholders extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_placeholders'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_plugins.php b/admin/models/components_plugins.php index ca59efe78..3bfafdba9 100644 --- a/admin/models/components_plugins.php +++ b/admin/models/components_plugins.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_plugins extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_plugins extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_plugins')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_plugins extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_plugins'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_site_views.php b/admin/models/components_site_views.php index 98a98b476..27426721d 100644 --- a/admin/models/components_site_views.php +++ b/admin/models/components_site_views.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_site_views extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_site_views extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_site_views')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_site_views extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_site_views'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/components_updates.php b/admin/models/components_updates.php index 4f481267c..caa6a7680 100644 --- a/admin/models/components_updates.php +++ b/admin/models/components_updates.php @@ -94,7 +94,7 @@ class ComponentbuilderModelComponents_updates extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelComponents_updates extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_component_updates')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelComponents_updates extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_component_updates'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/custom_admin_views.php b/admin/models/custom_admin_views.php index 34f2a8d0b..b0b77d966 100644 --- a/admin/models/custom_admin_views.php +++ b/admin/models/custom_admin_views.php @@ -187,7 +187,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -672,17 +672,19 @@ class ComponentbuilderModelCustom_admin_views extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_custom_admin_view')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -697,7 +699,7 @@ class ComponentbuilderModelCustom_admin_views extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_custom_admin_view'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/custom_codes.php b/admin/models/custom_codes.php index 160bb9b85..fbd8a0d5e 100644 --- a/admin/models/custom_codes.php +++ b/admin/models/custom_codes.php @@ -134,7 +134,7 @@ class ComponentbuilderModelCustom_codes extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -590,17 +590,19 @@ class ComponentbuilderModelCustom_codes extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_custom_code')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -615,7 +617,7 @@ class ComponentbuilderModelCustom_codes extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_custom_code'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/dynamic_gets.php b/admin/models/dynamic_gets.php index cbbf55d4d..a04f7cb53 100644 --- a/admin/models/dynamic_gets.php +++ b/admin/models/dynamic_gets.php @@ -118,7 +118,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -503,17 +503,19 @@ class ComponentbuilderModelDynamic_gets extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_dynamic_get')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -528,7 +530,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_dynamic_get'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/fields.php b/admin/models/fields.php index 756eb2e9a..dc32a6bbc 100644 --- a/admin/models/fields.php +++ b/admin/models/fields.php @@ -214,7 +214,7 @@ class ComponentbuilderModelFields extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -858,17 +858,19 @@ class ComponentbuilderModelFields extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_field')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -883,7 +885,7 @@ class ComponentbuilderModelFields extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_field'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/fieldtypes.php b/admin/models/fieldtypes.php index 29e633d43..e6129fb03 100644 --- a/admin/models/fieldtypes.php +++ b/admin/models/fieldtypes.php @@ -126,7 +126,7 @@ class ComponentbuilderModelFieldtypes extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -467,17 +467,19 @@ class ComponentbuilderModelFieldtypes extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_fieldtype')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -492,7 +494,7 @@ class ComponentbuilderModelFieldtypes extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_fieldtype'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/forms/joomla_module.xml b/admin/models/forms/joomla_module.xml index 160b6db62..e4e0579a1 100644 --- a/admin/models/forms/joomla_module.xml +++ b/admin/models/forms/joomla_module.xml @@ -647,6 +647,64 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_COMPONENT + + + + + + + + + + + + + + + + checkInNow(); // load parent items @@ -506,17 +506,19 @@ class ComponentbuilderModelHelp_documents extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_help_document')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -531,7 +533,7 @@ class ComponentbuilderModelHelp_documents extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_help_document'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index b3767b912..503acd031 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -2304,7 +2304,7 @@ class ComponentbuilderModelJoomla_components extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -2756,17 +2756,19 @@ class ComponentbuilderModelJoomla_components extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_joomla_component')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -2781,7 +2783,7 @@ class ComponentbuilderModelJoomla_components extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_joomla_component'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/joomla_modules.php b/admin/models/joomla_modules.php index 4702cc60a..73a407fc9 100644 --- a/admin/models/joomla_modules.php +++ b/admin/models/joomla_modules.php @@ -118,7 +118,7 @@ class ComponentbuilderModelJoomla_modules extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -329,17 +329,19 @@ class ComponentbuilderModelJoomla_modules extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_joomla_module')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -354,7 +356,7 @@ class ComponentbuilderModelJoomla_modules extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_joomla_module'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/joomla_modules_files_folders_urls.php b/admin/models/joomla_modules_files_folders_urls.php index 383a8f533..6f883c835 100644 --- a/admin/models/joomla_modules_files_folders_urls.php +++ b/admin/models/joomla_modules_files_folders_urls.php @@ -94,7 +94,7 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_joomla_module_files_folders_urls')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_joomla_module_files_folders_urls'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/joomla_modules_updates.php b/admin/models/joomla_modules_updates.php index d2c0a4edb..ece517811 100644 --- a/admin/models/joomla_modules_updates.php +++ b/admin/models/joomla_modules_updates.php @@ -94,7 +94,7 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_joomla_module_updates')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_joomla_module_updates'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/joomla_plugin_groups.php b/admin/models/joomla_plugin_groups.php index 96574dc18..db1b680d2 100644 --- a/admin/models/joomla_plugin_groups.php +++ b/admin/models/joomla_plugin_groups.php @@ -110,7 +110,7 @@ class ComponentbuilderModelJoomla_plugin_groups extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -269,17 +269,19 @@ class ComponentbuilderModelJoomla_plugin_groups extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_joomla_plugin_group')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -294,7 +296,7 @@ class ComponentbuilderModelJoomla_plugin_groups extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_joomla_plugin_group'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/joomla_plugins.php b/admin/models/joomla_plugins.php index d9d0a2be0..7260d50cc 100644 --- a/admin/models/joomla_plugins.php +++ b/admin/models/joomla_plugins.php @@ -288,7 +288,7 @@ class ComponentbuilderModelJoomla_plugins extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -490,17 +490,19 @@ class ComponentbuilderModelJoomla_plugins extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_joomla_plugin')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -515,7 +517,7 @@ class ComponentbuilderModelJoomla_plugins extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_joomla_plugin'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/joomla_plugins_files_folders_urls.php b/admin/models/joomla_plugins_files_folders_urls.php index 1764069d7..141d3e495 100644 --- a/admin/models/joomla_plugins_files_folders_urls.php +++ b/admin/models/joomla_plugins_files_folders_urls.php @@ -94,7 +94,7 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_joomla_plugin_files_folders_urls'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/joomla_plugins_updates.php b/admin/models/joomla_plugins_updates.php index 6c17342da..404c898af 100644 --- a/admin/models/joomla_plugins_updates.php +++ b/admin/models/joomla_plugins_updates.php @@ -94,7 +94,7 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_joomla_plugin_updates')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_joomla_plugin_updates'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/language_translations.php b/admin/models/language_translations.php index 7f5afe643..2cf9fa98e 100644 --- a/admin/models/language_translations.php +++ b/admin/models/language_translations.php @@ -189,7 +189,7 @@ class ComponentbuilderModelLanguage_translations extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -676,17 +676,19 @@ class ComponentbuilderModelLanguage_translations extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_language_translation')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -701,7 +703,7 @@ class ComponentbuilderModelLanguage_translations extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_language_translation'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/languages.php b/admin/models/languages.php index 8707b47ca..2c2040c90 100644 --- a/admin/models/languages.php +++ b/admin/models/languages.php @@ -233,7 +233,7 @@ class ComponentbuilderModelLanguages extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -514,17 +514,19 @@ class ComponentbuilderModelLanguages extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_language')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -539,7 +541,7 @@ class ComponentbuilderModelLanguages extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_language'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/layouts.php b/admin/models/layouts.php index 4261763b9..f40249259 100644 --- a/admin/models/layouts.php +++ b/admin/models/layouts.php @@ -126,7 +126,7 @@ class ComponentbuilderModelLayouts extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -485,17 +485,19 @@ class ComponentbuilderModelLayouts extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_layout')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -510,7 +512,7 @@ class ComponentbuilderModelLayouts extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_layout'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/libraries.php b/admin/models/libraries.php index c487d2de2..c338037a9 100644 --- a/admin/models/libraries.php +++ b/admin/models/libraries.php @@ -134,7 +134,7 @@ class ComponentbuilderModelLibraries extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -418,17 +418,19 @@ class ComponentbuilderModelLibraries extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_library')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -443,7 +445,7 @@ class ComponentbuilderModelLibraries extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_library'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/libraries_config.php b/admin/models/libraries_config.php index 6b19a4c25..39142cb2d 100644 --- a/admin/models/libraries_config.php +++ b/admin/models/libraries_config.php @@ -94,7 +94,7 @@ class ComponentbuilderModelLibraries_config extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelLibraries_config extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_library_config')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelLibraries_config extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_library_config'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/libraries_files_folders_urls.php b/admin/models/libraries_files_folders_urls.php index a761ceaf0..6564426d2 100644 --- a/admin/models/libraries_files_folders_urls.php +++ b/admin/models/libraries_files_folders_urls.php @@ -94,7 +94,7 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -240,17 +240,19 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_library_files_folders_urls')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -265,7 +267,7 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_library_files_folders_urls'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/placeholders.php b/admin/models/placeholders.php index 272cd6b86..63c5119e2 100644 --- a/admin/models/placeholders.php +++ b/admin/models/placeholders.php @@ -110,7 +110,7 @@ class ComponentbuilderModelPlaceholders extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -395,17 +395,19 @@ class ComponentbuilderModelPlaceholders extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_placeholder')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -420,7 +422,7 @@ class ComponentbuilderModelPlaceholders extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_placeholder'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/servers.php b/admin/models/servers.php index 969a9977d..e6cad44db 100644 --- a/admin/models/servers.php +++ b/admin/models/servers.php @@ -110,7 +110,7 @@ class ComponentbuilderModelServers extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -510,17 +510,19 @@ class ComponentbuilderModelServers extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_server')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -535,7 +537,7 @@ class ComponentbuilderModelServers extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_server'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/site_views.php b/admin/models/site_views.php index e8eedda05..ce75c8edd 100644 --- a/admin/models/site_views.php +++ b/admin/models/site_views.php @@ -195,7 +195,7 @@ class ComponentbuilderModelSite_views extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -681,17 +681,19 @@ class ComponentbuilderModelSite_views extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_site_view')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -706,7 +708,7 @@ class ComponentbuilderModelSite_views extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_site_view'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/snippet_types.php b/admin/models/snippet_types.php index e56e28eac..08b26f9c7 100644 --- a/admin/models/snippet_types.php +++ b/admin/models/snippet_types.php @@ -110,7 +110,7 @@ class ComponentbuilderModelSnippet_types extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -269,17 +269,19 @@ class ComponentbuilderModelSnippet_types extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_snippet_type')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -294,7 +296,7 @@ class ComponentbuilderModelSnippet_types extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_snippet_type'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/snippets.php b/admin/models/snippets.php index b30063c79..9a8f86e45 100644 --- a/admin/models/snippets.php +++ b/admin/models/snippets.php @@ -248,7 +248,7 @@ class ComponentbuilderModelSnippets extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -576,17 +576,19 @@ class ComponentbuilderModelSnippets extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_snippet')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -601,7 +603,7 @@ class ComponentbuilderModelSnippets extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_snippet'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/templates.php b/admin/models/templates.php index 39ede6229..684ab27ab 100644 --- a/admin/models/templates.php +++ b/admin/models/templates.php @@ -126,7 +126,7 @@ class ComponentbuilderModelTemplates extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -485,17 +485,19 @@ class ComponentbuilderModelTemplates extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_template')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -510,7 +512,7 @@ class ComponentbuilderModelTemplates extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_template'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/models/validation_rules.php b/admin/models/validation_rules.php index 8e0fc82b3..ead2271b9 100644 --- a/admin/models/validation_rules.php +++ b/admin/models/validation_rules.php @@ -110,7 +110,7 @@ class ComponentbuilderModelValidation_rules extends JModelList */ public function getItems() { - // check in items + // Check in items $this->checkInNow(); // load parent items @@ -393,17 +393,19 @@ class ComponentbuilderModelValidation_rules extends JModelList // Get a db connection. $db = JFactory::getDbo(); - // reset query + // Reset query. $query = $db->getQuery(true); $query->select('*'); $query->from($db->quoteName('#__componentbuilder_validation_rule')); - $db->setQuery($query); + // Only select items that are checked out. + $query->where($db->quoteName('checked_out') . '!=0'); + $db->setQuery($query, 0, 1); $db->execute(); if ($db->getNumRows()) { - // Get Yesterdays date + // Get Yesterdays date. $date = JFactory::getDate()->modify($time)->toSql(); - // reset query + // Reset query. $query = $db->getQuery(true); // Fields to update. @@ -418,7 +420,7 @@ class ComponentbuilderModelValidation_rules extends JModelList $db->quoteName('checked_out_time') . '<\''.$date.'\'' ); - // Check table + // Check table. $query->update($db->quoteName('#__componentbuilder_validation_rule'))->set($fields)->where($conditions); $db->setQuery($query); diff --git a/admin/views/admin_custom_tabs/view.html.php b/admin/views/admin_custom_tabs/view.html.php index 1470f8143..7a8cbc4db 100644 --- a/admin/views/admin_custom_tabs/view.html.php +++ b/admin/views/admin_custom_tabs/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewAdmin_custom_tabs extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admin_custom_tabs'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admin_custom_tabs'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/admin_fields/view.html.php b/admin/views/admin_fields/view.html.php index 7bee7b0a6..aa2f62426 100644 --- a/admin/views/admin_fields/view.html.php +++ b/admin/views/admin_fields/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewAdmin_fields extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admin_fields'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admin_fields'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/admin_fields_conditions/view.html.php b/admin/views/admin_fields_conditions/view.html.php index e5eeeb989..d23c4f0aa 100644 --- a/admin/views/admin_fields_conditions/view.html.php +++ b/admin/views/admin_fields_conditions/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewAdmin_fields_conditions extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admin_fields_conditions'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admin_fields_conditions'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/admin_fields_relations/view.html.php b/admin/views/admin_fields_relations/view.html.php index a3d11866a..a5663f78f 100644 --- a/admin/views/admin_fields_relations/view.html.php +++ b/admin/views/admin_fields_relations/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewAdmin_fields_relations extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admin_fields_relations'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admin_fields_relations'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/admin_view/view.html.php b/admin/views/admin_view/view.html.php index 0ab507005..d673c6735 100644 --- a/admin/views/admin_view/view.html.php +++ b/admin/views/admin_view/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewAdmin_view extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admin_view'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admin_view'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/admin_views/view.html.php b/admin/views/admin_views/view.html.php index 7bb4e7d98..9fff10040 100644 --- a/admin/views/admin_views/view.html.php +++ b/admin/views/admin_views/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewAdmin_views extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admin_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admin_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/admins_custom_tabs/view.html.php b/admin/views/admins_custom_tabs/view.html.php index b2eb1441b..72148c519 100644 --- a/admin/views/admins_custom_tabs/view.html.php +++ b/admin/views/admins_custom_tabs/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewAdmins_custom_tabs extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admins_custom_tabs'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admins_custom_tabs'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/admins_fields/view.html.php b/admin/views/admins_fields/view.html.php index 0f9578493..c2b73967c 100644 --- a/admin/views/admins_fields/view.html.php +++ b/admin/views/admins_fields/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewAdmins_fields extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admins_fields'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admins_fields'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/admins_fields_conditions/view.html.php b/admin/views/admins_fields_conditions/view.html.php index ba4554bdd..fe4de943a 100644 --- a/admin/views/admins_fields_conditions/view.html.php +++ b/admin/views/admins_fields_conditions/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewAdmins_fields_conditions extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admins_fields_conditions'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admins_fields_conditions'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/admins_fields_relations/view.html.php b/admin/views/admins_fields_relations/view.html.php index 7c6043483..8a175ff8b 100644 --- a/admin/views/admins_fields_relations/view.html.php +++ b/admin/views/admins_fields_relations/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewAdmins_fields_relations extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('admins_fields_relations'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('admins_fields_relations'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/class_extendings/view.html.php b/admin/views/class_extendings/view.html.php index 171cb0c7f..427b9fd60 100644 --- a/admin/views/class_extendings/view.html.php +++ b/admin/views/class_extendings/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewClass_extendings extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('class_extendings'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('class_extendings'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/class_extends/view.html.php b/admin/views/class_extends/view.html.php index bfc6fde5a..aa432667b 100644 --- a/admin/views/class_extends/view.html.php +++ b/admin/views/class_extends/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewClass_extends extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('class_extends'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('class_extends'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/class_method/view.html.php b/admin/views/class_method/view.html.php index 83174bd37..20873dbbc 100644 --- a/admin/views/class_method/view.html.php +++ b/admin/views/class_method/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewClass_method extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('class_method'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('class_method'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/class_methods/view.html.php b/admin/views/class_methods/view.html.php index 849778bee..dc003c06c 100644 --- a/admin/views/class_methods/view.html.php +++ b/admin/views/class_methods/view.html.php @@ -147,10 +147,10 @@ class ComponentbuilderViewClass_methods extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('class_methods'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('class_methods'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/class_properties/view.html.php b/admin/views/class_properties/view.html.php index 775d7b801..1a24ea13d 100644 --- a/admin/views/class_properties/view.html.php +++ b/admin/views/class_properties/view.html.php @@ -147,10 +147,10 @@ class ComponentbuilderViewClass_properties extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('class_properties'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('class_properties'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/class_property/view.html.php b/admin/views/class_property/view.html.php index bd53bfd77..9248f770a 100644 --- a/admin/views/class_property/view.html.php +++ b/admin/views/class_property/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewClass_property extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('class_property'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('class_property'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index db7d52ec6..207134b80 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -310,7 +310,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy jQuery.get(noticeboard) .success(function(board) { if (board.length > 5) { - jQuery(\".noticeboard-md\").html(marked(board)); + jQuery(\".noticeboard-md\").html(marked.parse(board)); getIS(1,board).done(function(result) { if (result){ jQuery(\".vdm-new-notice\").show(); @@ -327,7 +327,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy jQuery.get(proboard) .success(function(board) { if (board.length > 5) { - jQuery(\".proboard-md\").html(marked(board)); + jQuery(\".proboard-md\").html(marked.parse(board)); } else { jQuery(\".proboard-md\").html(all_is_good); } @@ -391,10 +391,10 @@ class ComponentbuilderViewCompiler extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('compiler'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('compiler'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/component_admin_views/view.html.php b/admin/views/component_admin_views/view.html.php index c1c6672cc..b1bc6a80c 100644 --- a/admin/views/component_admin_views/view.html.php +++ b/admin/views/component_admin_views/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_admin_views extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_admin_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_admin_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_config/view.html.php b/admin/views/component_config/view.html.php index d587a749a..956a7eaa1 100644 --- a/admin/views/component_config/view.html.php +++ b/admin/views/component_config/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_config extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_config'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_config'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_custom_admin_menus/view.html.php b/admin/views/component_custom_admin_menus/view.html.php index 73fc4ae83..45ecc11cb 100644 --- a/admin/views/component_custom_admin_menus/view.html.php +++ b/admin/views/component_custom_admin_menus/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_custom_admin_menus extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_custom_admin_menus'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_custom_admin_menus'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_custom_admin_views/view.html.php b/admin/views/component_custom_admin_views/view.html.php index 4a0ffa64a..a22b00644 100644 --- a/admin/views/component_custom_admin_views/view.html.php +++ b/admin/views/component_custom_admin_views/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_custom_admin_views extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_custom_admin_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_custom_admin_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_dashboard/view.html.php b/admin/views/component_dashboard/view.html.php index fde6f2f25..c6b9a5618 100644 --- a/admin/views/component_dashboard/view.html.php +++ b/admin/views/component_dashboard/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_dashboard extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_dashboard'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_dashboard'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_files_folders/view.html.php b/admin/views/component_files_folders/view.html.php index da593a5cd..ffe48dad0 100644 --- a/admin/views/component_files_folders/view.html.php +++ b/admin/views/component_files_folders/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_files_folders extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_files_folders'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_files_folders'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_modules/view.html.php b/admin/views/component_modules/view.html.php index c9e8adbc8..414bee80f 100644 --- a/admin/views/component_modules/view.html.php +++ b/admin/views/component_modules/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_modules extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_modules'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_modules'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_mysql_tweaks/view.html.php b/admin/views/component_mysql_tweaks/view.html.php index 988764990..3a7f557bb 100644 --- a/admin/views/component_mysql_tweaks/view.html.php +++ b/admin/views/component_mysql_tweaks/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_mysql_tweaks extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_mysql_tweaks'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_mysql_tweaks'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_placeholders/view.html.php b/admin/views/component_placeholders/view.html.php index 847047c13..cdbfa52f6 100644 --- a/admin/views/component_placeholders/view.html.php +++ b/admin/views/component_placeholders/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_placeholders extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_placeholders'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_placeholders'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_plugins/view.html.php b/admin/views/component_plugins/view.html.php index 679bfc45c..801d3852a 100644 --- a/admin/views/component_plugins/view.html.php +++ b/admin/views/component_plugins/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_plugins extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_plugins'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_plugins'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_site_views/view.html.php b/admin/views/component_site_views/view.html.php index 1c5c31508..5e68385dd 100644 --- a/admin/views/component_site_views/view.html.php +++ b/admin/views/component_site_views/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_site_views extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_site_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_site_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/component_updates/view.html.php b/admin/views/component_updates/view.html.php index 04855c151..b2d4e7020 100644 --- a/admin/views/component_updates/view.html.php +++ b/admin/views/component_updates/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewComponent_updates extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('component_updates'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('component_updates'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/componentbuilder/view.html.php b/admin/views/componentbuilder/view.html.php index 9f0d6f782..ad7ebe547 100644 --- a/admin/views/componentbuilder/view.html.php +++ b/admin/views/componentbuilder/view.html.php @@ -63,10 +63,10 @@ class ComponentbuilderViewComponentbuilder extends JViewLegacy JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_DASHBOARD'), 'grid-2'); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('componentbuilder'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('componentbuilder'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } if ($canDo->get('core.admin') || $canDo->get('core.options')) diff --git a/admin/views/components_admin_views/view.html.php b/admin/views/components_admin_views/view.html.php index b9aeba7f5..f5d8ab210 100644 --- a/admin/views/components_admin_views/view.html.php +++ b/admin/views/components_admin_views/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_admin_views extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_admin_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_admin_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_config/view.html.php b/admin/views/components_config/view.html.php index 8694b1266..5be830841 100644 --- a/admin/views/components_config/view.html.php +++ b/admin/views/components_config/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_config extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_config'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_config'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_custom_admin_menus/view.html.php b/admin/views/components_custom_admin_menus/view.html.php index 06de1e62d..3eced497b 100644 --- a/admin/views/components_custom_admin_menus/view.html.php +++ b/admin/views/components_custom_admin_menus/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_custom_admin_menus extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_custom_admin_menus'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_custom_admin_menus'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_custom_admin_views/view.html.php b/admin/views/components_custom_admin_views/view.html.php index 1cd822d6c..035146151 100644 --- a/admin/views/components_custom_admin_views/view.html.php +++ b/admin/views/components_custom_admin_views/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_custom_admin_views extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_custom_admin_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_custom_admin_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_dashboard/view.html.php b/admin/views/components_dashboard/view.html.php index c44238252..4b2e649a1 100644 --- a/admin/views/components_dashboard/view.html.php +++ b/admin/views/components_dashboard/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_dashboard extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_dashboard'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_dashboard'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_files_folders/view.html.php b/admin/views/components_files_folders/view.html.php index 0dcbaed1b..b9c7207f6 100644 --- a/admin/views/components_files_folders/view.html.php +++ b/admin/views/components_files_folders/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_files_folders extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_files_folders'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_files_folders'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_modules/view.html.php b/admin/views/components_modules/view.html.php index 5a988c10b..995deedb2 100644 --- a/admin/views/components_modules/view.html.php +++ b/admin/views/components_modules/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_modules extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_modules'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_modules'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_mysql_tweaks/view.html.php b/admin/views/components_mysql_tweaks/view.html.php index 3bf7d6d47..70c6a83bf 100644 --- a/admin/views/components_mysql_tweaks/view.html.php +++ b/admin/views/components_mysql_tweaks/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_mysql_tweaks extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_mysql_tweaks'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_mysql_tweaks'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_placeholders/view.html.php b/admin/views/components_placeholders/view.html.php index fc78018d7..0124abac5 100644 --- a/admin/views/components_placeholders/view.html.php +++ b/admin/views/components_placeholders/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_placeholders extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_placeholders'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_placeholders'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_plugins/view.html.php b/admin/views/components_plugins/view.html.php index 6262169ad..5a2a02fb8 100644 --- a/admin/views/components_plugins/view.html.php +++ b/admin/views/components_plugins/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_plugins extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_plugins'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_plugins'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_site_views/view.html.php b/admin/views/components_site_views/view.html.php index fd8b1caf1..c34214081 100644 --- a/admin/views/components_site_views/view.html.php +++ b/admin/views/components_site_views/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_site_views extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_site_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_site_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/components_updates/view.html.php b/admin/views/components_updates/view.html.php index bdfd15ce5..6221a98ce 100644 --- a/admin/views/components_updates/view.html.php +++ b/admin/views/components_updates/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewComponents_updates extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('components_updates'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('components_updates'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/custom_admin_view/view.html.php b/admin/views/custom_admin_view/view.html.php index 64f222bad..909b43c8d 100644 --- a/admin/views/custom_admin_view/view.html.php +++ b/admin/views/custom_admin_view/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewCustom_admin_view extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('custom_admin_view'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('custom_admin_view'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/custom_admin_views/view.html.php b/admin/views/custom_admin_views/view.html.php index e7816d21f..269d6f029 100644 --- a/admin/views/custom_admin_views/view.html.php +++ b/admin/views/custom_admin_views/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewCustom_admin_views extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('custom_admin_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('custom_admin_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/custom_code/view.html.php b/admin/views/custom_code/view.html.php index 4097c6469..86622d143 100644 --- a/admin/views/custom_code/view.html.php +++ b/admin/views/custom_code/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewCustom_code extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('custom_code'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('custom_code'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/custom_codes/view.html.php b/admin/views/custom_codes/view.html.php index 69cd9495f..8a8cc386b 100644 --- a/admin/views/custom_codes/view.html.php +++ b/admin/views/custom_codes/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewCustom_codes extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('custom_codes'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('custom_codes'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/dynamic_get/view.html.php b/admin/views/dynamic_get/view.html.php index 19cf405c7..1aa339f9f 100644 --- a/admin/views/dynamic_get/view.html.php +++ b/admin/views/dynamic_get/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewDynamic_get extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('dynamic_get'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('dynamic_get'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/dynamic_gets/view.html.php b/admin/views/dynamic_gets/view.html.php index 6594bbe06..30cbd2c66 100644 --- a/admin/views/dynamic_gets/view.html.php +++ b/admin/views/dynamic_gets/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewDynamic_gets extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('dynamic_gets'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('dynamic_gets'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/field/view.html.php b/admin/views/field/view.html.php index 68fe2a49b..1499d2e07 100644 --- a/admin/views/field/view.html.php +++ b/admin/views/field/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewField extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('field'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('field'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/fields/view.html.php b/admin/views/fields/view.html.php index a0becc03f..59d86d9a6 100644 --- a/admin/views/fields/view.html.php +++ b/admin/views/fields/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewFields extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('fields'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('fields'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/fieldtype/view.html.php b/admin/views/fieldtype/view.html.php index 993adb10b..c7ff7b428 100644 --- a/admin/views/fieldtype/view.html.php +++ b/admin/views/fieldtype/view.html.php @@ -153,10 +153,10 @@ class ComponentbuilderViewFieldtype extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('fieldtype'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('fieldtype'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/fieldtypes/view.html.php b/admin/views/fieldtypes/view.html.php index 1031fefbb..364fbb89b 100644 --- a/admin/views/fieldtypes/view.html.php +++ b/admin/views/fieldtypes/view.html.php @@ -147,10 +147,10 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('fieldtypes'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('fieldtypes'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/get_snippets/view.html.php b/admin/views/get_snippets/view.html.php index 0012f51b1..9d237e45b 100644 --- a/admin/views/get_snippets/view.html.php +++ b/admin/views/get_snippets/view.html.php @@ -289,10 +289,10 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('get_snippets'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('get_snippets'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/help_document/view.html.php b/admin/views/help_document/view.html.php index 810ee0295..70747b5ae 100644 --- a/admin/views/help_document/view.html.php +++ b/admin/views/help_document/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewHelp_document extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('help_document'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('help_document'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/help_documents/view.html.php b/admin/views/help_documents/view.html.php index dd1d4f629..94e4aa451 100644 --- a/admin/views/help_documents/view.html.php +++ b/admin/views/help_documents/view.html.php @@ -147,10 +147,10 @@ class ComponentbuilderViewHelp_documents extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('help_documents'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('help_documents'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php index f3cf8eb6e..1be5fdd2a 100644 --- a/admin/views/import/view.html.php +++ b/admin/views/import/view.html.php @@ -85,10 +85,10 @@ class ComponentbuilderViewImport extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('import'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('import'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } } diff --git a/admin/views/import_joomla_components/view.html.php b/admin/views/import_joomla_components/view.html.php index f7c6a6cbe..7df5f96e1 100644 --- a/admin/views/import_joomla_components/view.html.php +++ b/admin/views/import_joomla_components/view.html.php @@ -450,10 +450,10 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('import_joomla_components'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('import_joomla_components'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } } diff --git a/admin/views/import_language_translations/view.html.php b/admin/views/import_language_translations/view.html.php index 159a0de7f..8fa95880c 100644 --- a/admin/views/import_language_translations/view.html.php +++ b/admin/views/import_language_translations/view.html.php @@ -84,10 +84,10 @@ class ComponentbuilderViewImport_language_translations extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('import_language_translations'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('import_language_translations'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } } diff --git a/admin/views/joomla_component/view.html.php b/admin/views/joomla_component/view.html.php index e8a26f9c2..74141674c 100644 --- a/admin/views/joomla_component/view.html.php +++ b/admin/views/joomla_component/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewJoomla_component extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_component'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_component'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/joomla_components/view.html.php b/admin/views/joomla_components/view.html.php index 3515b4b24..66a02279e 100644 --- a/admin/views/joomla_components/view.html.php +++ b/admin/views/joomla_components/view.html.php @@ -177,10 +177,10 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_components'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_components'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/joomla_module/view.html.php b/admin/views/joomla_module/view.html.php index d1564a860..240d90634 100644 --- a/admin/views/joomla_module/view.html.php +++ b/admin/views/joomla_module/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewJoomla_module extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_module'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_module'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/joomla_module_files_folders_urls/view.html.php b/admin/views/joomla_module_files_folders_urls/view.html.php index 7c63be884..e9be94ebf 100644 --- a/admin/views/joomla_module_files_folders_urls/view.html.php +++ b/admin/views/joomla_module_files_folders_urls/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewJoomla_module_files_folders_urls extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_module_files_folders_urls'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_module_files_folders_urls'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/joomla_module_updates/view.html.php b/admin/views/joomla_module_updates/view.html.php index 711e72e2c..d4ec249c7 100644 --- a/admin/views/joomla_module_updates/view.html.php +++ b/admin/views/joomla_module_updates/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewJoomla_module_updates extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_module_updates'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_module_updates'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/joomla_modules/view.html.php b/admin/views/joomla_modules/view.html.php index 1dfd74f4f..fe9db733c 100644 --- a/admin/views/joomla_modules/view.html.php +++ b/admin/views/joomla_modules/view.html.php @@ -147,10 +147,10 @@ class ComponentbuilderViewJoomla_modules extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_modules'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_modules'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/joomla_modules_files_folders_urls/view.html.php b/admin/views/joomla_modules_files_folders_urls/view.html.php index 8fb825779..50af7e3b1 100644 --- a/admin/views/joomla_modules_files_folders_urls/view.html.php +++ b/admin/views/joomla_modules_files_folders_urls/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewJoomla_modules_files_folders_urls extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_modules_files_folders_urls'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_modules_files_folders_urls'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/joomla_modules_updates/view.html.php b/admin/views/joomla_modules_updates/view.html.php index a8ce2ff75..585e582af 100644 --- a/admin/views/joomla_modules_updates/view.html.php +++ b/admin/views/joomla_modules_updates/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewJoomla_modules_updates extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_modules_updates'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_modules_updates'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/joomla_plugin/view.html.php b/admin/views/joomla_plugin/view.html.php index 334f1ac8d..773da7ca3 100644 --- a/admin/views/joomla_plugin/view.html.php +++ b/admin/views/joomla_plugin/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewJoomla_plugin extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/joomla_plugin_files_folders_urls/view.html.php b/admin/views/joomla_plugin_files_folders_urls/view.html.php index cfca9a0a8..3209b6e6d 100644 --- a/admin/views/joomla_plugin_files_folders_urls/view.html.php +++ b/admin/views/joomla_plugin_files_folders_urls/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewJoomla_plugin_files_folders_urls extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_files_folders_urls'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_files_folders_urls'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/joomla_plugin_group/view.html.php b/admin/views/joomla_plugin_group/view.html.php index d62533675..b4ad2b452 100644 --- a/admin/views/joomla_plugin_group/view.html.php +++ b/admin/views/joomla_plugin_group/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewJoomla_plugin_group extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_group'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_group'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/joomla_plugin_groups/view.html.php b/admin/views/joomla_plugin_groups/view.html.php index 1f6bf61a5..4c7d73810 100644 --- a/admin/views/joomla_plugin_groups/view.html.php +++ b/admin/views/joomla_plugin_groups/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewJoomla_plugin_groups extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_groups'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_groups'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/joomla_plugin_updates/view.html.php b/admin/views/joomla_plugin_updates/view.html.php index 480368a43..2b6082e26 100644 --- a/admin/views/joomla_plugin_updates/view.html.php +++ b/admin/views/joomla_plugin_updates/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewJoomla_plugin_updates extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_updates'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugin_updates'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/joomla_plugins/view.html.php b/admin/views/joomla_plugins/view.html.php index 44baeaa08..9bd98efe2 100644 --- a/admin/views/joomla_plugins/view.html.php +++ b/admin/views/joomla_plugins/view.html.php @@ -157,10 +157,10 @@ class ComponentbuilderViewJoomla_plugins extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/joomla_plugins_files_folders_urls/view.html.php b/admin/views/joomla_plugins_files_folders_urls/view.html.php index bdd7c9dfb..cb7d8df4e 100644 --- a/admin/views/joomla_plugins_files_folders_urls/view.html.php +++ b/admin/views/joomla_plugins_files_folders_urls/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewJoomla_plugins_files_folders_urls extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins_files_folders_urls'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins_files_folders_urls'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/joomla_plugins_updates/view.html.php b/admin/views/joomla_plugins_updates/view.html.php index 0fa952223..ddfe60e81 100644 --- a/admin/views/joomla_plugins_updates/view.html.php +++ b/admin/views/joomla_plugins_updates/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewJoomla_plugins_updates extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins_updates'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_plugins_updates'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/language/view.html.php b/admin/views/language/view.html.php index f5acb5adb..f4f85f4e1 100644 --- a/admin/views/language/view.html.php +++ b/admin/views/language/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewLanguage extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('language'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('language'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/language_translation/view.html.php b/admin/views/language_translation/view.html.php index 95bf1a9c5..7e22642a3 100644 --- a/admin/views/language_translation/view.html.php +++ b/admin/views/language_translation/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewLanguage_translation extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('language_translation'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('language_translation'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/language_translations/view.html.php b/admin/views/language_translations/view.html.php index e0387a387..100146b15 100644 --- a/admin/views/language_translations/view.html.php +++ b/admin/views/language_translations/view.html.php @@ -147,10 +147,10 @@ class ComponentbuilderViewLanguage_translations extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('language_translations'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('language_translations'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/languages/view.html.php b/admin/views/languages/view.html.php index e4bbad60c..84fe993e7 100644 --- a/admin/views/languages/view.html.php +++ b/admin/views/languages/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewLanguages extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('languages'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('languages'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/layout/view.html.php b/admin/views/layout/view.html.php index 0a7dbae78..7c730c0e9 100644 --- a/admin/views/layout/view.html.php +++ b/admin/views/layout/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewLayout extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('layout'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('layout'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/layouts/view.html.php b/admin/views/layouts/view.html.php index f0a16681e..f334157da 100644 --- a/admin/views/layouts/view.html.php +++ b/admin/views/layouts/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewLayouts extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('layouts'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('layouts'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/libraries/view.html.php b/admin/views/libraries/view.html.php index be0c92ec7..19fbe74d8 100644 --- a/admin/views/libraries/view.html.php +++ b/admin/views/libraries/view.html.php @@ -142,10 +142,10 @@ class ComponentbuilderViewLibraries extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('libraries'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('libraries'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/libraries_config/view.html.php b/admin/views/libraries_config/view.html.php index e937fcf33..4404f192b 100644 --- a/admin/views/libraries_config/view.html.php +++ b/admin/views/libraries_config/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewLibraries_config extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('libraries_config'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('libraries_config'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/libraries_files_folders_urls/view.html.php b/admin/views/libraries_files_folders_urls/view.html.php index 8ca23bc1e..414e83dd5 100644 --- a/admin/views/libraries_files_folders_urls/view.html.php +++ b/admin/views/libraries_files_folders_urls/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewLibraries_files_folders_urls extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('libraries_files_folders_urls'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('libraries_files_folders_urls'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/library/view.html.php b/admin/views/library/view.html.php index 713cf69c1..8f112390d 100644 --- a/admin/views/library/view.html.php +++ b/admin/views/library/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewLibrary extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('library'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('library'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/library_config/view.html.php b/admin/views/library_config/view.html.php index 2b81ea337..23e7ed569 100644 --- a/admin/views/library_config/view.html.php +++ b/admin/views/library_config/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewLibrary_config extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('library_config'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('library_config'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/library_files_folders_urls/view.html.php b/admin/views/library_files_folders_urls/view.html.php index 6d0c97d78..92e372ae6 100644 --- a/admin/views/library_files_folders_urls/view.html.php +++ b/admin/views/library_files_folders_urls/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewLibrary_files_folders_urls extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('library_files_folders_urls'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('library_files_folders_urls'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/placeholder/view.html.php b/admin/views/placeholder/view.html.php index fd2251c68..02d723b54 100644 --- a/admin/views/placeholder/view.html.php +++ b/admin/views/placeholder/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewPlaceholder extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('placeholder'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('placeholder'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/placeholders/view.html.php b/admin/views/placeholders/view.html.php index 2f18d3837..2248343b1 100644 --- a/admin/views/placeholders/view.html.php +++ b/admin/views/placeholders/view.html.php @@ -147,10 +147,10 @@ class ComponentbuilderViewPlaceholders extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('placeholders'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('placeholders'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/server/view.html.php b/admin/views/server/view.html.php index 77872b738..8ea315579 100644 --- a/admin/views/server/view.html.php +++ b/admin/views/server/view.html.php @@ -153,10 +153,10 @@ class ComponentbuilderViewServer extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('server'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('server'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/servers/view.html.php b/admin/views/servers/view.html.php index edf56826d..edcabb67d 100644 --- a/admin/views/servers/view.html.php +++ b/admin/views/servers/view.html.php @@ -147,10 +147,10 @@ class ComponentbuilderViewServers extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('servers'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('servers'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/site_view/view.html.php b/admin/views/site_view/view.html.php index 6af297408..95d028d3c 100644 --- a/admin/views/site_view/view.html.php +++ b/admin/views/site_view/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewSite_view extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('site_view'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('site_view'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/site_views/view.html.php b/admin/views/site_views/view.html.php index 578b67025..4ee3f95b9 100644 --- a/admin/views/site_views/view.html.php +++ b/admin/views/site_views/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewSite_views extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('site_views'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('site_views'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/snippet/view.html.php b/admin/views/snippet/view.html.php index 459c0b248..420f84c63 100644 --- a/admin/views/snippet/view.html.php +++ b/admin/views/snippet/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewSnippet extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('snippet'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('snippet'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/snippet_type/view.html.php b/admin/views/snippet_type/view.html.php index a77d759e1..bfb531347 100644 --- a/admin/views/snippet_type/view.html.php +++ b/admin/views/snippet_type/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewSnippet_type extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('snippet_type'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('snippet_type'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/snippet_types/view.html.php b/admin/views/snippet_types/view.html.php index 7f57cde84..0af44fd8f 100644 --- a/admin/views/snippet_types/view.html.php +++ b/admin/views/snippet_types/view.html.php @@ -137,10 +137,10 @@ class ComponentbuilderViewSnippet_types extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('snippet_types'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('snippet_types'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/snippets/view.html.php b/admin/views/snippets/view.html.php index dad361636..d6ce5bd0f 100644 --- a/admin/views/snippets/view.html.php +++ b/admin/views/snippets/view.html.php @@ -157,10 +157,10 @@ class ComponentbuilderViewSnippets extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('snippets'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('snippets'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/template/view.html.php b/admin/views/template/view.html.php index 85b2d28af..1628c6670 100644 --- a/admin/views/template/view.html.php +++ b/admin/views/template/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewTemplate extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('template'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('template'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/templates/view.html.php b/admin/views/templates/view.html.php index 98c83156a..9e4a9ac87 100644 --- a/admin/views/templates/view.html.php +++ b/admin/views/templates/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewTemplates extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('templates'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('templates'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/admin/views/validation_rule/view.html.php b/admin/views/validation_rule/view.html.php index b36fa9b8c..9f8f8ed82 100644 --- a/admin/views/validation_rule/view.html.php +++ b/admin/views/validation_rule/view.html.php @@ -150,10 +150,10 @@ class ComponentbuilderViewValidation_rule extends JViewLegacy } JToolbarHelper::divider(); // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('validation_rule'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('validation_rule'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } } diff --git a/admin/views/validation_rules/view.html.php b/admin/views/validation_rules/view.html.php index 7b781a7c6..a0101e371 100644 --- a/admin/views/validation_rules/view.html.php +++ b/admin/views/validation_rules/view.html.php @@ -152,10 +152,10 @@ class ComponentbuilderViewValidation_rules extends JViewLegacy } // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('validation_rules'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('validation_rules'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // add the options comp button diff --git a/componentbuilder.xml b/componentbuilder.xml index 01a31a84d..e23928999 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,15 +1,15 @@ COM_COMPONENTBUILDER - 15th January, 2022 + 4th April, 2022 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com Copyright (C) 2015 Vast Development Method. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 2.12.15 + 2.12.16 Component Builder (v.2.12.15) +

Component Builder (v.2.12.16)

The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time. diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index 8a3e5eac1..1aec446ae 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -1041,10 +1041,10 @@ Builds Complex Joomla Components com_componentbuilder component - 2.12.15 + 2.12.16 http://www.joomlacomponentbuilder.com - https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.15/JCB_v2.12.15.zip + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.16/JCB_v2.12.16.zip stable diff --git a/libraries/jcb_powers/.htaccess b/libraries/jcb_powers/.htaccess new file mode 100644 index 000000000..9afb1a1b3 --- /dev/null +++ b/libraries/jcb_powers/.htaccess @@ -0,0 +1,9 @@ +# Apache 2.4+ + + Require all denied + + +# Apache 2.0-2.2 + + Deny from all + diff --git a/libraries/jcb_powers/VDM.Joomla/index.html b/libraries/jcb_powers/VDM.Joomla/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities.php new file mode 100644 index 000000000..7656d7c77 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities.php @@ -0,0 +1,598 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla; + + +use VDM\Joomla\Utilities\StringHelper; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\ObjectHelper; +use VDM\Joomla\Utilities\MathHelper; +use VDM\Joomla\Utilities\GetHelper; +use VDM\Joomla\Utilities\GuidHelper; +use VDM\Joomla\Utilities\FileHelper; +use VDM\Joomla\Utilities\String\FieldHelper; +use VDM\Joomla\Utilities\String\TypeHelper; +use VDM\Joomla\Utilities\String\ClassfunctionHelper; +use VDM\Joomla\Utilities\String\NamespaceHelper; +use VDM\Joomla\Utilities\String\PluginHelper; + + +/** + * Basic shared utilities, a legacy implementation + * + * @since 3.0.9 + */ +trait Utilities +{ + /** + * The Main Active Language + * + * @var string + * + * @since 3.0.9 + */ + public static $langTag; + + /** + * Check if have a string with a length + * + * @input string $string The string to check + * + * @returns bool true on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringHelper::check($string); + */ + public static function checkString($string): bool + { + return StringHelper::check($string); + } + + /** + * Shorten a string + * + * @input string $string That you would like to shorten + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringHelper::shorten($string, $length, $addTip); + */ + public static function shorten($string, $length = 40, $addTip = true) + { + return StringHelper::shorten($string, $length, $addTip); + } + + /** + * Making strings safe (various ways) + * + * @input string $string That you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters); + */ + public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + return StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters); + } + + /** + * Making class or function name safe + * + * @input string The name you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use ClassfunctionHelper::safe($name); + */ + public static function safeClassFunctionName($name) + { + return ClassfunctionHelper::safe($name); + } + + /** + * Making field names safe + * + * @input string The you would like to make safe + * @input boolean The switch to return an ALL UPPER CASE string + * @input string The string to use in white space + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FieldHelper::safe($string, $allcap, $spacer); + */ + public static function safeFieldName($string, $allcap = false, $spacer = '_') + { + return FieldHelper::safe($string, $allcap, $spacer); + } + + /** + * Making field type name safe + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use TypeHelper::safe($string); + */ + public static function safeTypeName($string) + { + return TypeHelper::safe($string); + } + + /** + * Making namespace safe + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use NamespaceHelper::safe($string); + */ + public static function safeNamespace($string) + { + return NamespaceHelper::safe($string); + } + + /** + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringHelper::transliterate($string); + */ + public static function transliterate($string) + { + return StringHelper::transliterate($string); + } + + /** + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringHelper::html($var, $charset, $shorten, $length); + */ + public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) + { + return StringHelper::html($var, $charset, $shorten, $length); + } + + /** + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringHelper::numbers($string); + */ + public static function replaceNumbers($string) + { + return StringHelper::numbers($string); + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input int $x an int + * + * @returns string a string + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringHelper::number($x); + */ + public static function numberToString($x) + { + return StringHelper::number($x); + } + + /** + * Random Key + * + * @input int $size the length of the string + * + * @returns string a string of random characters + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use StringHelper::random($size); + */ + public static function randomkey($size): string + { + return StringHelper::random($size); + } + + /** + * Check if you have a json string + * + * @input string $string The json string to check + * + * @returns bool true on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use JsonHelper::check($string); + */ + public static function checkJson($string): bool + { + return JsonHelper::check($string); + } + + /** + * @since 3.0.9 + * + * @deprecated 4.0 - Use JsonHelper::string($value, $sperator, $table, $id, $name); + */ + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') + { + return JsonHelper::string($value, $sperator, $table, $id, $name); + } + + /** + * Check if you have an array with a length + * + * @input mixed $array The array to check + * @input bool $removeEmptyString Should we remove empty values + * + * @returns int number of items in array on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use ArrayHelper::check($array, $removeEmptyString); + */ + public static function checkArray($array, $removeEmptyString = false): int + { + return ArrayHelper::check($array, $removeEmptyString); + } + + /** + * Merge an array of array's + * + * @input mixed $arrays The arrays you would like to merge + * + * @returns mixed array on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use ArrayHelper::merge($arrays); + */ + public static function mergeArrays($arrays) + { + return ArrayHelper::merge($arrays); + } + + /** + * Check if you have an object with a length + * + * @input object $object The object to check + * + * @returns bool true on success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use ObjectHelper::check($object); + */ + public static function checkObject($object): bool + { + return ObjectHelper::check($object); + } + + /** + * 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 + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GetHelper::var($table, $where, $whereString, $what, $operator, $main); + */ + public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder') + { + return GetHelper::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 + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique); + */ + public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true) + { + return GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique); + } + + /** + * get all strings between two other strings + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * + * @return array On success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GetHelper::allBetween($content, $start, $end); + */ + public static function getAllBetween($content, $start, $end) + { + return GetHelper::allBetween($content, $start, $end); + } + + /** + * get a string between two other strings + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * @param string $default The default value if none found + * + * @return string On success / empty string on failure + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GetHelper::between($content, $start, $end, $default); + */ + public static function getBetween($content, $start, $end, $default = '') + { + return GetHelper::between($content, $start, $end, $default); + } + + /** + * bc math wrapper (very basic not for accounting) + * + * @param string $type The type bc math + * @param int $val1 The first value + * @param int $val2 The second value + * @param int $scale The scale value + * + * @return float|int + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use MathHelper::bc($type, $val1, $val2, $scale); + */ + public static function bcmath($type, $val1, $val2, $scale = 0) + { + return MathHelper::bc($type, $val1, $val2, $scale); + } + + /** + * Basic sum of an array with more precision + * + * @param array $array The values to sum + * @param int $scale The scale value + * + * @return float|int + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use MathHelper::sum($array, $scale); + */ + public static function bcsum($array, $scale = 4) + { + return MathHelper::sum($array, $scale); + } + + /** + * create plugin class name + * + * @input string The group name + * @input string The name + * + * @return string + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use PluginHelper::safe($name, $group); + */ + public static function createPluginClassName($group, $name) + { + return PluginHelper::safeClassName($name, $group); + } + + /** + * Returns a GUIDv4 string + * + * Thanks to Dave Pearson (and other) + * https://www.php.net/manual/en/function.com-create-guid.php#119168 + * + * Uses the best cryptographically secure method + * for all supported platforms with fallback to an older, + * less secure version. + * + * @param bool $trim + * + * @return string + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GuidHelper::get($trim); + */ + public static function GUID($trim = true) + { + return GuidHelper::get($trim); + } + + /** + * Validate the Globally Unique Identifier ( and check if table already has this identifier) + * + * @param string $guid + * @param string $table + * @param int $id + * + * @return bool + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id); + */ + public static function validGUID($guid, $table = null, $id = 0) + { + return GuidHelper::valid($guid, $table, $id); + } + + /** + * get the ITEM of a GUID by table + * + * @param string $guid + * @param string $table + * @param string/array $what + * + * @return mix + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id); + */ + public static function getGUID($guid, $table, $what = 'a.id') + { + return GuidHelper::item($guid, $table, $what); + } + + /** + * Validate the Globally Unique Identifier + * + * Thanks to Lewie + * https://stackoverflow.com/a/1515456/1429677 + * + * @param string $guid + * + * @return bool + * + * @deprecated 4.0 - Use GuidHelper::validate($guid); + */ + protected static function validateGUID($guid) + { + return GuidHelper::validate($guid); + } + + /** + * The zipper method + * + * @param string $workingDIR The directory where the items must be zipped + * @param string $filepath The path to where the zip file must be placed + * + * @return bool true On success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::zip($workingDIR, $filepath); + */ + public static function zip($workingDIR, &$filepath) + { + return FileHelper::zip($workingDIR, $filepath); + } + + /** + * get the content of a file + * + * @param string $path The path to the file + * @param string/bool $none The return value if no content was found + * + * @return string On success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::getContent($path, $none); + */ + public static function getFileContents($path, $none = '') + { + return FileHelper::getContent($path, $none); + } + + /** + * Write a file to the server + * + * @param string $path The path and file name where to safe the data + * @param string $data The data to safe + * + * @return bool true On success + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::write($path, $data); + */ + public static function writeFile($path, $data) + { + return FileHelper::write($path, $data); + } + + /** + * get all the file paths in folder and sub folders + * + * @param string $folder The local path to parse + * @param array $fileTypes The type of files to get + * + * @return void + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::getPaths($folder, $fileTypes , $recurse, $full); + */ + public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true) + { + return FileHelper::getPaths($folder, $fileTypes , $recurse, $full); + } + + /** + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $fileType The kind of filename to generate (if not set no file name is generated) + * @param string $key The key to adjust the filename (if not set ignored) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * + * @since 3.0.9 + * + * @deprecated 4.0 - Use FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet); + */ + public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) + { + return FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/ArrayHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/ArrayHelper.php new file mode 100644 index 000000000..76ca4d51c --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/ArrayHelper.php @@ -0,0 +1,80 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities; + + +/** + * Some array tricks helper + * + * @since 3.0.9 + */ +abstract class ArrayHelper +{ + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + * + * @since 3.0.9 + */ + public static function check($array, $removeEmptyString = false) + { + if (is_array($array) && ($nr = count((array)$array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + foreach ($array as $key => $string) + { + if (empty($string)) + { + unset($array[$key]); + } + } + return self::check($array, false); + } + return $nr; + } + return false; + } + + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + * + * @since 3.0.9 + */ + public static function merge($arrays) + { + if(self::check($arrays)) + { + $arrayBuket = array(); + foreach ($arrays as $array) + { + if (self::check($array)) + { + $arrayBuket = array_merge($arrayBuket, $array); + } + } + return $arrayBuket; + } + return false; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php new file mode 100644 index 000000000..afa3bb290 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FileHelper.php @@ -0,0 +1,327 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\Archive\Archive; + + +/** + * File helper + * + * @since 3.0.9 + */ +abstract class FileHelper +{ + /** + * Trigger error notice only once + * + * @var bool + * + * @since 3.0.9 + */ + protected static $curlError = false; + + /** + * The component params + * + * @var object + * + * @since 3.0.9 + */ + protected static $params = false; + + /** + * The zipper method + * + * @param string $workingDirectory The directory where the items must be zipped + * @param string $filepath The path to where the zip file must be placed + * + * @return bool true On success + * + * @since 3.0.9 + */ + public static function zip($workingDirectory, &$filepath) + { + // store the current joomla working directory + $joomla = getcwd(); + + // we are changing the working directory to the component temp folder + chdir($workingDirectory); + + // the full file path of the zip file + $filepath = Path::clean($filepath); + + // delete an existing zip file (or use an exclusion parameter in Folder::files() + File::delete($filepath); + + // get a list of files in the current directory tree (also the hidden files) + $files = Folder::files('.', '', true, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('.*~')); + + $zipArray = array(); + // setup the zip array + foreach ($files as $file) + { + $tmp = array(); + $tmp['name'] = str_replace('./', '', $file); + $tmp['data'] = self::getContent($file); + $tmp['time'] = filemtime($file); + $zipArray[] = $tmp; + } + + // change back to joomla working directory + chdir($joomla); + + // get the zip adapter + $adapter = new Archive(); + $zip = $adapter->getAdapter('zip'); + + //create the zip file + if ($zip->create($filepath, $zipArray)) + { + return true; + } + return false; + } + + /** + * get the content of a file + * + * @param string $path The path to the file + * @param string/bool $none The return value if no content was found + * + * @return string On success + * + * @since 3.0.9 + */ + public static function getContent($path, $none = '') + { + if (StringHelper::check($path)) + { + // use basic file get content for now + if (($content = @file_get_contents($path)) !== FALSE) + { + return $content; + } + // use curl if available + elseif (function_exists('curl_version')) + { + // start curl + $ch = curl_init(); + // set the options + $options = array(); + $options[CURLOPT_URL] = $path; + $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; + $options[CURLOPT_RETURNTRANSFER] = TRUE; + $options[CURLOPT_SSL_VERIFYPEER] = FALSE; + // load the options + curl_setopt_array($ch, $options); + // get the content + $content = curl_exec($ch); + // close the connection + curl_close($ch); + + // return if found + if (StringHelper::check($content)) + { + return $content; + } + } + elseif (!self::$curlError) + { + // set the notice + Factory::getApplication()->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); + // load this notice only once + self::$curlError = true; + } + } + return $none; + } + + /** + * Write a file to the server + * + * @param string $path The path and file name where to safe the data + * @param string $data The data to safe + * + * @return bool true On success + * + * @since 3.0.9 + */ + public static function write($path, $data) + { + $klaar = false; + if (StringHelper::check($data)) + { + // open the file + $fh = fopen($path, "w"); + if (!is_resource($fh)) + { + return $klaar; + } + // write to the file + if (fwrite($fh, $data)) + { + // has been done + $klaar = true; + } + // close file. + fclose($fh); + } + return $klaar; + } + + /** + * get all the file paths in folder and sub folders + * + * @param string $folder The local path to parse + * @param array $fileTypes The type of files to get + * + * @return void + * + * @since 3.0.9 + */ + public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true) + { + if (Folder::exists($folder)) + { + // we must first store the current woking directory + $joomla = getcwd(); + // we are changing the working directory to the component path + chdir($folder); + + // make sure we have file type filter + if (ArrayHelper::check($fileTypes)) + { + // get the files + foreach ($fileTypes as $type) + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', $type, $recurse, $full); + } + } + elseif (StringHelper::check($fileTypes)) + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', $fileTypes, $recurse, $full); + } + else + { + // get a list of files in the current directory tree + $files[] = Folder::files('.', '.', $recurse, $full); + } + + // change back to Joomla working directory + chdir($joomla); + + // return array of files + return array_map( function($file) { return str_replace('./', '/', $file); }, (array) ArrayHelper::merge($files)); + } + return false; + } + + /** + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $fileType The kind of filename to generate (if not set no file name is generated) + * @param string $key The key to adjust the filename (if not set ignored) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * + * @since 3.0.9 + */ + public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) + { + // make sure to always have a string/path + if(!StringHelper::check($default)) + { + $default = JPATH_SITE . '/images/'; + } + + // get the global settings + if (!ObjectHelper::check(self::$params)) + { + self::$params = ComponentHelper::getParams('com_componentbuilder'); + } + $filePath = self::$params->get($target, $default); + + // check the file path (revert to default only of not a hidden file path) + if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false) + { + $filePath = $default; + } + + // create the folder if it does not exist + if ($createIfNotSet && !Folder::exists($filePath)) + { + Folder::create($filePath); + } + + // setup the file name + $fileName = ''; + + // Get basic key + $basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug'; + if (method_exists('ComponentbuilderHelper', "getCryptKey")) + { + $basickey = ComponentbuilderHelper::getCryptKey('basic', $basickey); + } + + // check the key + if (!StringHelper::check($key)) + { + $key = 'vDm'; + } + + // set the file name + if (StringHelper::check($fileType)) + { + // set the name + $fileName = trim(md5($type . $target . $basickey . $key) . '.' . trim($fileType, '.')); + } + else + { + $fileName = trim(md5($type . $target . $basickey . $key)) . '.txt'; + } + + // return the url + if ('url' === $type) + { + if (strpos($filePath, JPATH_SITE) !== false) + { + $filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/'); + + return Uri::root() . $filePath . '/' . $fileName; + } + + // since the path is behind the root folder of the site, return only the root url (may be used to build the link) + return Uri::root(); + } + + // sanitize the path + return '/' . trim( $filePath, '/' ) . '/' . $fileName; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php new file mode 100644 index 000000000..967f39282 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GetHelper.php @@ -0,0 +1,228 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Factory; + + +/** + * Some easy get... + * + * @since 3.0.9 + */ +abstract class GetHelper +{ + /** + * 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 + * + * @since 3.0.9 + */ + public static function var($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder') + { + if(!$where) + { + $where = Factory::getUser()->id; + } + + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + + if (empty($table)) + { + $query->from($db->quoteName('#__' . $main)); + } + else + { + $query->from($db->quoteName('#__' . $main . '_' . $table)); + } + + if (is_numeric($where)) + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' ' . (int) $where); + } + elseif (is_string($where)) + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' ' . $db->quote((string)$where)); + } + else + { + return false; + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + return $db->loadResult(); + } + return false; + } + + /** + * 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 + * + * @since 3.0.9 + */ + public static function vars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true) + { + if(!$where) + { + $where = Factory::getUser()->id; + } + + if (!ArrayHelper::check($where) && $where > 0) + { + $where = array($where); + } + + if (ArrayHelper::check($where)) + { + // prep main <-- why? well if $main='' is empty then $table can be categories or users + if (StringHelper::check($main)) + { + $main = '_' . ltrim($main, '_'); + } + + // Get a db connection. + $db = Factory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + + if (empty($table)) + { + $query->from($db->quoteName('#__' . $main)); + } + else + { + $query->from($db->quoteName('#_' . $main . '_' . $table)); + } + + // add strings to array search + if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) + { + $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); + } + else + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); + } + + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + if ($unique) + { + return array_unique($db->loadColumn()); + } + return $db->loadColumn(); + } + } + return false; + } + + /** + * get all strings between two other strings + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * + * @return array On success + * + * @since 3.0.9 + */ + public static function allBetween($content, $start, $end) + { + // reset bucket + $bucket = array(); + for ($i = 0; ; $i++) + { + // search for string + $found = self::between($content,$start,$end); + if (StringHelper::check($found)) + { + // add to bucket + $bucket[] = $found; + // build removal string + $remove = $start.$found.$end; + // remove from content + $content = str_replace($remove,'',$content); + } + else + { + break; + } + // safety catch + if ($i == 500) + { + break; + } + } + // only return unique array of values + return array_unique($bucket); + } + + /** + * get a string between two other strings + * + * @param string $content The content to search + * @param string $start The starting value + * @param string $end The ending value + * @param string $default The default value if none found + * + * @return string On success / empty string on failure + * + * @since 3.0.9 + */ + public static function between($content, $start, $end, $default = '') + { + $r = explode($start, $content); + if (isset($r[1])) + { + $r = explode($end, $r[1]); + return $r[0]; + } + return $default; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php new file mode 100644 index 000000000..b68431b87 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/GuidHelper.php @@ -0,0 +1,205 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Factory; + + +/** + * Global Unique ID Helper + * + * @since 3.0.9 + */ +abstract class GuidHelper +{ + /** + * Returns a GUIDv4 string + * + * Thanks to Dave Pearson (and other) + * https://www.php.net/manual/en/function.com-create-guid.php#119168 + * + * Uses the best cryptographically secure method + * for all supported platforms with fallback to an older, + * less secure version. + * + * @param bool $trim + * + * @return string + * + * @since 3.0.9 + */ + public static function get($trim = true) + { + // Windows + if (function_exists('com_create_guid') === true) + { + if ($trim === true) + { + return trim(com_create_guid(), '{}'); + } + return com_create_guid(); + } + + // set the braces if needed + $lbrace = $trim ? "" : chr(123); // "{" + $rbrace = $trim ? "" : chr(125); // "}" + + // OSX/Linux + if (function_exists('openssl_random_pseudo_bytes') === true) + { + $data = openssl_random_pseudo_bytes(16); + $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 + $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 + return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace; + } + + // Fallback (PHP 4.2+) + mt_srand((double)microtime() * 10000); + $charid = strtolower(md5(uniqid(rand(), true))); + $hyphen = chr(45); // "-" + $guidv4 = $lbrace. + substr($charid, 0, 8).$hyphen. + substr($charid, 8, 4).$hyphen. + substr($charid, 12, 4).$hyphen. + substr($charid, 16, 4).$hyphen. + substr($charid, 20, 12). + $rbrace; + return $guidv4; + } + + /** + * Validate the Globally Unique Identifier ( and check if table already has this identifier) + * + * @param string $guid + * @param string $table + * @param int $id + * + * @return bool + * + * @since 3.0.9 + */ + public static function valid($guid, $table = null, $id = 0) + { + // check if we have a string + if (self::validate($guid)) + { + // check if table already has this identifier + if (StringHelper::check($table)) + { + // Get the database object and a new query object. + $db = Factory::getDbo(); + $query = $db->getQuery(true); + $query->select('COUNT(*)') + ->from('#__componentbuilder_' . (string) $table) + ->where($db->quoteName('guid') . ' = ' . $db->quote($guid)); + + // remove this item from the list + if ($id > 0) + { + $query->where($db->quoteName('id') . ' <> ' . (int) $id); + } + + // Set and query the database. + $db->setQuery($query); + $duplicate = (bool) $db->loadResult(); + + if ($duplicate) + { + return false; + } + } + return true; + } + return false; + } + + /** + * get the item by guid in a table + * + * @param string $guid + * @param string $table + * @param string/array $what + * + * @return mix + * + * @since 3.0.9 + */ + public static function item($guid, $table, $what = 'a.id') + { + // check if we have a string + if (self::validate($guid)) + { + // check if table already has this identifier + if (StringHelper::check($table)) + { + // Get the database object and a new query object. + $db = Factory::getDbo(); + $query = $db->getQuery(true); + + if (ArrayHelper::check($what)) + { + $query->select($db->quoteName($what)); + } + else + { + $query->select($what); + } + + $query->from($db->quoteName('#__componentbuilder_' . (string) $table, 'a')) + ->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid)); + + // Set and query the database. + $db->setQuery($query); + $db->execute(); + + if ($db->getNumRows()) + { + if (ArrayHelper::check($what) || $what === 'a.*') + { + return $db->loadObject(); + } + else + { + return $db->loadResult(); + } + } + } + } + return false; + } + + /** + * Validate the Globally Unique Identifier + * + * Thanks to Lewie + * https://stackoverflow.com/a/1515456/1429677 + * + * @param string $guid + * + * @return bool + * + * @since 3.0.9 + */ + protected static function validate($guid) + { + // check if we have a string + if (StringHelper::check($guid)) + { + return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $guid); + } + return false; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/JsonHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/JsonHelper.php new file mode 100644 index 000000000..fcffdf046 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/JsonHelper.php @@ -0,0 +1,102 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities; + + +/** + * The json checker + * + * @since 3.0.9 + */ +abstract class JsonHelper +{ + /** + * Check if you have a json string + * + * @input string $string The json string to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($string): bool + { + if (StringHelper::check($string)) + { + json_decode($string); + return (json_last_error() === JSON_ERROR_NONE); + } + + return false; + } + + /** + * Convert a json object to a string + * + * @input string $value The json string to convert + * + * @returns a string + * + * @since 3.0.9 + */ + public static function string($value, $separator = ", ", $table = null, $id = 'id', $name = 'name') + { + // do some table foot work + $external = false; + if (strpos($table, '#__') !== false) + { + $external = true; + $table = str_replace('#__', '', $table); + } + + // check if string is JSON + $result = json_decode($value, true); + if (json_last_error() === JSON_ERROR_NONE) + { + // is JSON + if (ArrayHelper::check($result)) + { + if (StringHelper::check($table)) + { + $names = array(); + foreach ($result as $val) + { + if ($external) + { + if ($_name = GetHelper::var(null, $val, $id, $name, '=', $table)) + { + $names[] = $_name; + } + } + else + { + if ($_name = GetHelper::var($table, $val, $id, $name)) + { + $names[] = $_name; + } + } + } + if (ArrayHelper::check($names)) + { + return (string) implode($separator, $names); + } + } + return (string) implode($separator, $result); + } + return (string) json_decode($value); + } + return $value; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/MathHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/MathHelper.php new file mode 100644 index 000000000..bfb5ca5cc --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/MathHelper.php @@ -0,0 +1,104 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities; + + +/** + * Basic Math Helper + * + * @since 3.0.9 + */ +abstract class MathHelper +{ + /** + * bc math wrapper (very basic not for accounting) + * + * @param string $type The type bc math + * @param int $val1 The first value + * @param int $val2 The second value + * @param int $scale The scale value + * + * @return int + * + * @since 3.0.9 + */ + public static function bc($type, $val1, $val2, $scale = 0) + { + // build function name + $function = 'bc' . $type; + // use the bcmath function if available + if (function_exists($function)) + { + return $function($val1, $val2, $scale); + } + // if function does not exist we use +-*/ operators (fallback - not ideal) + switch ($type) + { + // Multiply two numbers + case 'mul': + return (string) round($val1 * $val2, $scale); + break; + // Divide of two numbers + case 'div': + return (string) round($val1 / $val2, $scale); + break; + // Adding two numbers + case 'add': + return (string) round($val1 + $val2, $scale); + break; + // Subtract one number from the other + case 'sub': + return (string) round($val1 - $val2, $scale); + break; + // Raise an arbitrary precision number to another + case 'pow': + return (string) round(pow($val1, $val2), $scale); + break; + // Compare two arbitrary precision numbers + case 'comp': + return (round($val1,2) == round($val2,2)); + break; + } + return false; + } + + /** + * Basic sum of an array with more precision + * + * @param array $array The values to sum + * @param int $scale The scale value + * + * @return float + * + * @since 3.0.9 + */ + public static function sum($array, $scale = 4) + { + // use the bcadd function if available + if (function_exists('bcadd')) + { + // set the start value + $value = 0.0; + // loop the values and run bcadd + foreach($array as $val) + { + $value = bcadd($value, $val, $scale); + } + return $value; + } + // fall back on array sum + return array_sum($array); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/ObjectHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/ObjectHelper.php new file mode 100644 index 000000000..74dd8fd09 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/ObjectHelper.php @@ -0,0 +1,43 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities; + + +/** + * Some object tricks + * + * @since 3.0.9 + */ +abstract class ObjectHelper +{ + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($object) + { + if (is_object($object)) + { + return count((array) $object) > 0; + } + + return false; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/ClassfunctionHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/ClassfunctionHelper.php new file mode 100644 index 000000000..52e3bf761 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/ClassfunctionHelper.php @@ -0,0 +1,48 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities\String; + + +use VDM\Joomla\Utilities\StringHelper; + + +/** + * Control the naming of a class and function + * + * @since 3.0.9 + */ +abstract class ClassfunctionHelper +{ + /** + * Making class or function name safe + * + * @input string The name you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($name) + { + // remove numbers if the first character is a number + if (is_numeric(substr($name, 0, 1))) + { + $name = StringHelper::numbers($name); + } + + // remove all spaces and strange characters + return trim(preg_replace("/[^A-Za-z0-9_-]/", '', $name)); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/FieldHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/FieldHelper.php new file mode 100644 index 000000000..0893a276c --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/FieldHelper.php @@ -0,0 +1,103 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities\String; + + +use Joomla\CMS\Component\ComponentHelper; +use VDM\Joomla\Utilities\StringHelper; + + +/** + * Control the naming of a field + * + * @since 3.0.9 + */ +abstract class FieldHelper +{ + /** + * The field builder switch + * + * @since 3.0.9 + */ + protected static $builder = false; + + /** + * Making field names safe + * + * @input string The string you would like to make safe + * @input boolean The switch to return an ALL UPPER CASE string + * @input string The string to use in white space + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string, $allcap = false, $spacer = '_') + { + // get global value + if (self::$builder === false) + { + self::$builder = ComponentHelper::getParams('com_componentbuilder')->get('field_name_builder', 1); + } + + // use the new convention + if (2 == self::$builder) + { + // 0nly continue if we have a string + if (StringHelper::check($string)) + { + // check that the first character is not a number + if (is_numeric(substr($string, 0, 1))) + { + $string = StringHelper::numbers($string); + } + + // remove all other strange characters + $string = trim($string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + + // Transliterate string + $string = StringHelper::transliterate($string); + + // remove all and keep only characters and numbers + $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); + + // replace white space with underscore (SAFEST OPTION) + $string = preg_replace('/\s+/', $spacer, $string); + + // return all caps + if ($allcap) + { + return strtoupper($string); + } + + // default is to return lower + return strtolower($string); + } + // not a string + return ''; + } + + // return all caps + if ($allcap) + { + return StringHelper::safe($string, 'U'); + } + + // use the default (original behavior/convention) + return StringHelper::safe($string); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php new file mode 100644 index 000000000..e9b49f993 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/NamespaceHelper.php @@ -0,0 +1,60 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities\String; + + +use VDM\Joomla\Utilities\StringHelper; + + +/** + * Control the naming of a namespace helper + * + * @since 3.0.9 + */ +abstract class NamespaceHelper +{ + /** + * Making namespace safe + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string) + { + // 0nly continue if we have a string + if (StringHelper::check($string)) + { + // make sure it has not numbers + $string = StringHelper::numbers($string); + + // Transliterate string TODO: look again as this make it lowercase + // $string = StringHelper::transliterate($string); + + // first remove all [\] backslashes + $string = str_replace('\\', '1', $string); + + // remove all and keep only characters and [\] backslashes inside of the string + $string = trim(preg_replace("/[^A-Za-z1]/", '', $string), '1'); + + // place the [\] backslashes back + return trim(preg_replace("/1+/", '\\', $string)); + } + // not a string + return ''; + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/PluginHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/PluginHelper.php new file mode 100644 index 000000000..808e92f7e --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/PluginHelper.php @@ -0,0 +1,116 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities\String; + + +/** + * Control the naming of a plugin + * + * @since 3.0.9 + */ +abstract class PluginHelper +{ + /** + * Making plugin folder name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeFolderName($codeName, $group) + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'plg_' . strtolower($group) . '_' . strtolower( + $codeName + ); + } + + /** + * Making plugin class name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeClassName($codeName, $group) + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'Plg' . ucfirst($group) . ucfirst( + $codeName + ); + } + + /** + * Making plugin install class name safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeInstallClassName($codeName, $group) + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'plg' . ucfirst($group) . ucfirst( + $codeName + ) . 'InstallerScript'; + } + + /** + * Making language prefix safe + * + * @input string $codeName The name + * @input string $group The group name + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safeLangPrefix($codeName, $group) + { + // editors-xtd group plugins must have a class with plgButton structure + if ($group === 'editors-xtd') + { + $group = 'Button'; + } + + return 'PLG_' . strtoupper($group) . '_' . strtoupper( + $codeName + ); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php new file mode 100644 index 000000000..b97b6aaee --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/TypeHelper.php @@ -0,0 +1,81 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities\String; + + +use Joomla\CMS\Component\ComponentHelper; +use VDM\Joomla\Utilities\StringHelper; + + +/** + * Control the naming of a field type + * + * @since 3.0.9 + */ +abstract class TypeHelper +{ + /** + * The field builder switch + * + * @since 3.0.9 + */ + protected static $builder = false; + + /** + * Making field type name safe + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string) + { + // get global value + if (self::$builder === false) + { + self::$builder = ComponentHelper::getParams('com_componentbuilder')->get('type_name_builder', 1); + } + + // use the new convention + if (2 == self::$builder) + { + // 0nly continue if we have a string + if (StringHelper::check($string)) + { + // check that the first character is not a number + if (is_numeric(substr($string, 0, 1))) + { + $string = StringHelper::numbers($string); + } + + // Transliterate string + $string = StringHelper::transliterate($string); + + // remove all and keep only characters and numbers and point (TODO just one point) + $string = trim(preg_replace("/[^A-Za-z0-9\.]/", '', $string)); + + // best is to return lower (for all string equality in compiler) + return strtolower($string); + } + // not a string + return ''; + } + + // use the default (original behaviour/convention) + return StringHelper::safe($string); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/index.html b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php new file mode 100644 index 000000000..a2f0d92aa --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/StringHelper.php @@ -0,0 +1,420 @@ + + * @gitea Joomla Component Builder + * @github 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 + */ + +namespace VDM\Joomla\Utilities; + + +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Language\Language; +use Joomla\CMS\Component\ComponentHelper; + + +/** + * Some string tricks + * + * @since 3.0.9 + */ +abstract class StringHelper +{ + /** + * The Main Active Language + * + * @var string + * + * @since 3.0.9 + */ + public static $langTag; + + /** + * Check if we have a string with a length + * + * @input string $string The string to check + * + * @returns bool true on success + * + * @since 3.0.9 + */ + public static function check($string): bool + { + if (is_string($string) && strlen($string) > 0) + { + return true; + } + + return false; + } + + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function shorten($string, $length = 40, $addTip = true) + { + if (self::check($string)) + { + $initial = strlen($string); + $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); + $words_count = count((array)$words); + + $word_length = 0; + $last_word = 0; + for (; $last_word < $words_count; ++$last_word) + { + $word_length += strlen($words[$last_word]); + if ($word_length > $length) + { + break; + } + } + + $newString = implode(array_slice($words, 0, $last_word)); + $final = strlen($newString); + if ($initial != $final && $addTip) + { + $title = self::shorten($string, 400 , false); + return '' . trim($newString) . '...'; + } + elseif ($initial != $final && !$addTip) + { + return trim($newString) . '...'; + } + } + return $string; + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + * + * @since 3.0.9 + */ + public static function safe($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + if ($replaceNumbers === true) + { + // remove all numbers and replace with english text version (works well only up to millions) + $string = self::numbers($string); + } + // 0nly continue if we have a string + if (self::check($string)) + { + // create file name without the extension that is safe + if ($type === 'filename') + { + // make sure VDM is not in the string + $string = str_replace('VDM', 'vDm', $string); + // Remove anything which isn't a word, whitespace, number + // or any of the following caracters -_() + // If you don't need to handle multi-byte characters + // you can use preg_replace rather than mb_ereg_replace + // Thanks @Łukasz Rysiak! + // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); + $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); + + // http://stackoverflow.com/a/2021729/1429677 + return preg_replace('/\s+/', ' ', $string); + } + // remove all other characters + $string = trim($string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + // Transliterate string + $string = self::transliterate($string); + // remove all and keep only characters + if ($keepOnlyCharacters) + { + $string = preg_replace("/[^A-Za-z ]/", '', $string); + } + // keep both numbers and characters + else + { + $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); + } + // select final adaptations + if ($type === 'L' || $type === 'strtolower') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // default is to return lower + return strtolower($string); + } + elseif ($type === 'W') + { + // return a string with all first letter of each word uppercase(no underscore) + return ucwords(strtolower($string)); + } + elseif ($type === 'w' || $type === 'word') + { + // return a string with all lowercase(no underscore) + return strtolower($string); + } + elseif ($type === 'Ww' || $type === 'Word') + { + // return a string with first letter of the first word uppercase and all the rest lowercase(no underscore) + return ucfirst(strtolower($string)); + } + elseif ($type === 'WW' || $type === 'WORD') + { + // return a string with all the uppercase(no underscore) + return strtoupper($string); + } + elseif ($type === 'U' || $type === 'strtoupper') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // return all upper + return strtoupper($string); + } + elseif ($type === 'F' || $type === 'ucfirst') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // return with first character to upper + return ucfirst(strtolower($string)); + } + elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') + { + // convert all words to first letter uppercase + $string = ucwords(strtolower($string)); + // remove white space + $string = preg_replace('/\s+/', '', $string); + // now return first letter lowercase + return lcfirst($string); + } + // return string + return $string; + } + // not a string + return ''; + } + + /** + * Convert none English strings to code usable string + * + * @input an string + * + * @returns a string + * + * @since 3.0.9 + */ + public static function transliterate($string) + { + // set tag only once + if (!self::check(self::$langTag)) + { + // get global value + self::$langTag = ComponentHelper::getParams('com_componentbuilder')->get('language', 'en-GB'); + } + + // Transliterate on the language requested + $lang = Language::getInstance(self::$langTag); + + return $lang->transliterate($string); + } + + /** + * make sure a string is HTML save + * + * @input an html string + * + * @returns a string + * + * @since 3.0.9 + */ + public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40) + { + if (self::check($var)) + { + $filter = new InputFilter(); + $string = $filter->clean( + html_entity_decode( + htmlentities( + $var, + ENT_COMPAT, + $charset + ) + ), + 'HTML' + ); + if ($shorten) + { + return self::shorten($string, $length); + } + return $string; + } + else + { + return ''; + } + } + + /** + * Convert all int in a string to an English word string + * + * @input an string with numbers + * + * @returns a string + * + * @since 3.0.9 + */ + public static function numbers($string) + { + // set numbers array + $numbers = array(); + + // first get all numbers + preg_match_all('!\d+!', $string, $numbers); + + // check if we have any numbers + if (isset($numbers[0]) && ArrayHelper::check($numbers[0])) + { + foreach ($numbers[0] as $number) + { + $searchReplace[$number] = self::number((int)$number); + } + + // now replace numbers in string + $string = str_replace(array_keys($searchReplace), array_values($searchReplace), $string); + + // check if we missed any, strange if we did. + return self::numbers($string); + } + + // return the string with no numbers remaining. + return $string; + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + * + * @since 3.0.9 + */ + public static function number($x) + { + $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", + "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", + "nineteen", "twenty", 30 => "thirty", 40 => "forty", + 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", + 90 => "ninety" ); + + if(!is_numeric($x)) + { + $w = $x; + } + elseif(fmod($x, 1) != 0) + { + $w = $x; + } + else + { + if($x < 0) + { + $w = 'minus '; + $x = -$x; + } + else + { + $w = ''; + // ... now $x is a non-negative integer. + } + + if($x < 21) // 0 to 20 + { + $w .= $nwords[$x]; + } + elseif($x < 100) // 21 to 99 + { + $w .= $nwords[10 * floor($x/10)]; + $r = fmod($x, 10); + if($r > 0) + { + $w .= ' ' . $nwords[$r]; + } + } + elseif($x < 1000) // 100 to 999 + { + $w .= $nwords[floor($x/100)] .' hundred'; + $r = fmod($x, 100); + if($r > 0) + { + $w .= ' and '. self::number($r); + } + } + elseif($x < 1000000) // 1000 to 999999 + { + $w .= self::number(floor($x/1000)) .' thousand'; + $r = fmod($x, 1000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::number($r); + } + } + else // millions + { + $w .= self::number(floor($x/1000000)) .' million'; + $r = fmod($x, 1000000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::number($r); + } + } + } + return $w; + } + + /** + * Random Key + * + * @returns a string + * + * @since 3.0.9 + */ + public static function random($size) + { + $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; + $key = array(); + $bagsize = strlen($bag) - 1; + + for ($i = 0; $i < $size; $i++) + { + $get = rand(0, $bagsize); + $key[] = $bag[$get]; + } + + return implode($key); + } + +} + diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/index.html b/libraries/jcb_powers/VDM.Joomla/src/Utilities/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/htaccess.txt b/libraries/jcb_powers/htaccess.txt new file mode 100644 index 000000000..9afb1a1b3 --- /dev/null +++ b/libraries/jcb_powers/htaccess.txt @@ -0,0 +1,9 @@ +# Apache 2.4+ + + Require all denied + + +# Apache 2.0-2.2 + + Deny from all + diff --git a/libraries/jcb_powers/index.html b/libraries/jcb_powers/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/libraries/jcb_powers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/jcb_powers/web.config b/libraries/jcb_powers/web.config new file mode 100644 index 000000000..47b6d6db3 --- /dev/null +++ b/libraries/jcb_powers/web.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/script.php b/script.php index 5c939a7cd..0dbd6ab6a 100644 --- a/script.php +++ b/script.php @@ -9254,7 +9254,7 @@ class com_componentbuilderInstallerScript echo ' -

Upgrade to Version 2.12.15 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 2.12.16 Was Successful! Let us know if anything is not working as expected.

'; // Set db if not set already. if (!isset($db)) diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 4078aa9ed..780cae1ff 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -13,6 +13,50 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); + +// register this component namespace +spl_autoload_register(function ($class) { + // project-specific base directories and namespace prefix + $search = array( + 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' + ); + // Start the search and load if found + $found = false; + $found_base_dir = ""; + $found_len = 0; + foreach ($search as $base_dir => $prefix) + { + // does the class use the namespace prefix? + $len = strlen($prefix); + if (strncmp($prefix, $class, $len) === 0) + { + // we have a match so load the values + $found = true; + $found_base_dir = $base_dir; + $found_len = $len; + // done here + break; + } + } + // check if we found a match + if (!$found) + { + // no, move to the next registered autoloader + return; + } + // get the relative class name + $relative_class = substr($class, $found_len); + // replace the namespace prefix with the base directory, replace namespace + // separators with directory separators in the relative class name, append + // with .php + $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); + use Joomla\CMS\Language\Language; use Joomla\Registry\Registry; use Joomla\String\StringHelper; @@ -21,12 +65,20 @@ use Joomla\Archive\Archive; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Filesystem\Path; +use VDM\Joomla\Utilities; /** * Componentbuilder component helper */ abstract class ComponentbuilderHelper { + /** + * Adding the utilities trait to this class + * + * @deprecated 4.0 - Check the trait methods for details, a legacy implementation + */ + use Utilities; + /** * Composer Switch * @@ -34,13 +86,6 @@ abstract class ComponentbuilderHelper */ protected static $composer = array(); - /** - * The Main Active Language - * - * @var string - */ - public static $langTag; - /** * The Global Site Event Method. **/ @@ -662,157 +707,6 @@ abstract class ComponentbuilderHelper } } - /** - * Making class or function name safe - * - * @input string The name you would like to make safe - * - * @returns string on success - **/ - public static function safeClassFunctionName($name) - { - // remove numbers if the first character is a number - if (is_numeric(substr($name, 0, 1))) - { - $name = self::replaceNumbers($name); - } - // remove all spaces and strange characters - return trim(preg_replace("/[^A-Za-z0-9_-]/", '', $name)); - } - - /** - * The field builder switch - **/ - protected static $fieldNameBuilder = false; - - /** - * Making field names safe - * - * @input string The you would like to make safe - * @input boolean The switch to return an ALL UPPER CASE string - * @input string The string to use in white space - * - * @returns string on success - **/ - public static function safeFieldName($string, $allcap = false, $spacer = '_') - { - // get global value - if (self::$fieldNameBuilder === false) - { - self::$fieldNameBuilder = JComponentHelper::getParams('com_componentbuilder')->get('field_name_builder', 1); - } - // use the new convention - if (2 == self::$fieldNameBuilder) - { - // 0nly continue if we have a string - if (self::checkString($string)) - { - // check that the first character is not a number - if (is_numeric(substr($string, 0, 1))) - { - $string = self::replaceNumbers($string); - } - // remove all other strange characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters and numbers - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - // replace white space with underscore (SAFEST OPTION) - $string = preg_replace('/\s+/', $spacer, $string); - // return all caps - if ($allcap) - { - return strtoupper($string); - } - // default is to return lower - return strtolower($string); - } - // not a string - return ''; - } - // return all caps - if ($allcap) - { - return self::safeString($string, 'U'); - } - // use the default (original behaviour/convention) - return self::safeString($string); - } - - /** - * The type builder switch - **/ - protected static $typeNameBuilder = false; - - /** - * Making field type name safe - * - * @input string The you would like to make safe - * - * @returns string on success - **/ - public static function safeTypeName($string) - { - // get global value - if (self::$typeNameBuilder === false) - { - self::$typeNameBuilder = JComponentHelper::getParams('com_componentbuilder')->get('type_name_builder', 1); - } - // use the new convention - if (2 == self::$typeNameBuilder) - { - // 0nly continue if we have a string - if (self::checkString($string)) - { - // check that the first character is not a number - if (is_numeric(substr($string, 0, 1))) - { - $string = self::replaceNumbers($string); - } - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters and numbers and point (TODO just one point) - $string = trim(preg_replace("/[^A-Za-z0-9\.]/", '', $string)); - // best is to return lower (for all string equality in compiler) - return strtolower($string); - } - // not a string - return ''; - } - // use the default (original behaviour/convention) - return self::safeString($string); - } - - /** - * Making namespace safe - * - * @input string The you would like to make safe - * - * @returns string on success - **/ - public static function safeNamespace($string) - { - // 0nly continue if we have a string - if (self::checkString($string)) - { - // make sure it has not numbers - $string = self::replaceNumbers($string); - // Transliterate string TODO: look again as this make it lowercase - // $string = self::transliterate($string); - // first remove all [\] backslashes - $string = str_replace('\\', '1', $string); - // remove all and keep only characters and [\] backslashes inside of the string - $string = trim(preg_replace("/[^A-Za-z1]/", '', $string), '1'); - // place the [\] backslashes back - return trim(preg_replace("/1+/", '\\', $string)); - } - // not a string - return ''; - } - /* * Get the Array of Existing Validation Rule Names * @@ -1131,51 +1025,6 @@ abstract class ComponentbuilderHelper } } - /** - * get all the file paths in folder and sub folders - * - * @param string $folder The local path to parse - * @param array $fileTypes The type of files to get - * - * @return void - * - */ - public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true) - { - if (Folder::exists($folder)) - { - // we must first store the current woking directory - $joomla = getcwd(); - // we are changing the working directory to the component path - chdir($folder); - // make sure we have file type filter - if (self::checkArray($fileTypes)) - { - // get the files - foreach ($fileTypes as $type) - { - // get a list of files in the current directory tree - $files[] = Folder::files('.', $type, $recurse, $full); - } - } - elseif (self::checkString($fileTypes)) - { - // get a list of files in the current directory tree - $files[] = Folder::files('.', $fileTypes, $recurse, $full); - } - else - { - // get a list of files in the current directory tree - $files[] = Folder::files('.', '.', $recurse, $full); - } - // change back to Joomla working directory - chdir($joomla); - // return array of files - return array_map( function($file) { return str_replace('./', '/', $file); }, (array) self::mergeArrays($files)); - } - return false; - } - /** * get all component IDs */ @@ -2273,172 +2122,6 @@ abstract class ComponentbuilderHelper return $default; } - /** - * Returns a GUIDv4 string - * - * Thanks to Dave Pearson (and other) - * https://www.php.net/manual/en/function.com-create-guid.php#119168 - * - * Uses the best cryptographically secure method - * for all supported platforms with fallback to an older, - * less secure version. - * - * @param bool $trim - * @return string - */ - public static function GUID ($trim = true) - { - // Windows - if (function_exists('com_create_guid') === true) - { - if ($trim === true) - { - return trim(com_create_guid(), '{}'); - } - return com_create_guid(); - } - - // set the braces if needed - $lbrace = $trim ? "" : chr(123); // "{" - $rbrace = $trim ? "" : chr(125); // "}" - - // OSX/Linux - if (function_exists('openssl_random_pseudo_bytes') === true) - { - $data = openssl_random_pseudo_bytes(16); - $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 - $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 - return $lbrace . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . $lbrace; - } - - // Fallback (PHP 4.2+) - mt_srand((double)microtime() * 10000); - $charid = strtolower(md5(uniqid(rand(), true))); - $hyphen = chr(45); // "-" - $guidv4 = $lbrace. - substr($charid, 0, 8).$hyphen. - substr($charid, 8, 4).$hyphen. - substr($charid, 12, 4).$hyphen. - substr($charid, 16, 4).$hyphen. - substr($charid, 20, 12). - $rbrace; - return $guidv4; - } - - /** - * Validate the Globally Unique Identifier ( and check if table already has this identifier) - * - * @param string $guid - * @param string $table - * @param int $id - * @return bool - */ - public static function validGUID ($guid, $table = null, $id = 0) - { - // check if we have a string - if (self::validateGUID($guid)) - { - // check if table already has this identifier - if (self::checkString($table)) - { - // Get the database object and a new query object. - $db = \JFactory::getDbo(); - $query = $db->getQuery(true); - $query->select('COUNT(*)') - ->from('#__componentbuilder_' . (string) $table) - ->where($db->quoteName('guid') . ' = ' . $db->quote($guid)); - - // remove this item from the list - if ($id > 0) - { - $query->where($db->quoteName('id') . ' <> ' . (int) $id); - } - - // Set and query the database. - $db->setQuery($query); - $duplicate = (bool) $db->loadResult(); - - if ($duplicate) - { - return false; - } - } - return true; - } - return false; - } - - /** - * get the ITEM of a GUID by table - * - * @param string $guid - * @param string $table - * @param string/array $what - * - * @return mix - */ - public static function getGUID ($guid, $table, $what = 'a.id') - { - // check if we have a string - if (self::validateGUID($guid)) - { - // check if table already has this identifier - if (self::checkString($table)) - { - // Get the database object and a new query object. - $db = \JFactory::getDbo(); - $query = $db->getQuery(true); - if (self::checkArray($what)) - { - $query->select($db->quoteName($what)); - } - else - { - $query->select($what); - } - $query->from($db->quoteName('#__componentbuilder_' . (string) $table, 'a')) - ->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid)); - - // Set and query the database. - $db->setQuery($query); - $db->execute(); - - if ($db->getNumRows()) - { - if (self::checkArray($what) || $what === 'a.*') - { - return $db->loadObject(); - } - else - { - return $db->loadResult(); - } - } - } - } - return false; - } - - /** - * Validate the Globally Unique Identifier - * - * Thanks to Lewie - * https://stackoverflow.com/a/1515456/1429677 - * - * @param string $guid - * @return bool - */ - protected static function validateGUID ($guid) - { - // check if we have a string - if (self::checkString($guid)) - { - return preg_match("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i", $guid); - } - return false; - } - - /** * Tab/spacer bucket (to speed-up the build) * @@ -2797,91 +2480,6 @@ abstract class ComponentbuilderHelper } - /** - * The zipper method - * - * @param string $workingDIR The directory where the items must be zipped - * @param string $filepath The path to where the zip file must be placed - * - * @return bool true On success - * - */ - public static function zip($workingDIR, &$filepath) - { - // store the current joomla working directory - $joomla = getcwd(); - - // we are changing the working directory to the component temp folder - chdir($workingDIR); - - // the full file path of the zip file - $filepath = Path::clean($filepath); - - // delete an existing zip file (or use an exclusion parameter in Folder::files() - File::delete($filepath); - - // get a list of files in the current directory tree - $files = Folder::files('.', '', true, true); - $zipArray = array(); - // setup the zip array - foreach ($files as $file) - { - $tmp = array(); - $tmp['name'] = str_replace('./', '', $file); - $tmp['data'] = self::getFileContents($file); - $tmp['time'] = filemtime($file); - $zipArray[] = $tmp; - } - - // change back to joomla working directory - chdir($joomla); - - // get the zip adapter - $adapter = new Archive(); - $zip = $adapter->getAdapter('zip'); - - //create the zip file - if ($zip->create($filepath, $zipArray)) - { - return true; - } - return false; - } - - - /** - * Write a file to the server - * - * @param string $path The path and file name where to safe the data - * @param string $data The data to safe - * - * @return bool true On success - * - */ - public static function writeFile($path, $data) - { - $klaar = false; - if (self::checkString($data)) - { - // open the file - $fh = fopen($path, "w"); - if (!is_resource($fh)) - { - return $klaar; - } - // write to the file - if (fwrite($fh, $data)) - { - // has been done - $klaar = true; - } - // close file. - fclose($fh); - } - return $klaar; - } - - /** * Remove folders with files * @@ -3910,70 +3508,6 @@ abstract class ComponentbuilderHelper return false; } - /** - * get between - * - * @param string $content The content to search - * @param string $start The starting value - * @param string $end The ending value - * @param string $default The default value if none found - * - * @return string On success / empty string on failure - * - */ - public static function getBetween($content, $start, $end, $default = '') - { - $r = explode($start, $content); - if (isset($r[1])) - { - $r = explode($end, $r[1]); - return $r[0]; - } - return $default; - } - - /** - * get all between - * - * @param string $content The content to search - * @param string $start The starting value - * @param string $end The ending value - * - * @return array On success - * - */ - public static function getAllBetween($content, $start, $end) - { - // reset bucket - $bucket = array(); - for ($i = 0; ; $i++) - { - // search for string - $found = self::getBetween($content,$start,$end); - if (self::checkString($found)) - { - // add to bucket - $bucket[] = $found; - // build removal string - $remove = $start.$found.$end; - // remove from content - $content = str_replace($remove,'',$content); - } - else - { - break; - } - // safety catch - if ($i == 500) - { - break; - } - } - // only return unique array of values - return array_unique($bucket); - } - - /** * Field Grouping https://docs.joomla.org/Form_field **/ @@ -4206,81 +3740,6 @@ abstract class ComponentbuilderHelper return $exists; } - /** - * Get the file path or url - * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $fileType The kind of filename to generate (if not set no file name is generated) - * @param string $key The key to adjust the filename (if not set ignored) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found - * - * @return string On success the path or url is returned based on the type requested - * - */ - public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) - { - // make sure to always have a string/path - if(!self::checkString($default)) - { - $default = JPATH_SITE . '/images/'; - } - // get the global settings - if (!self::checkObject(self::$params)) - { - self::$params = JComponentHelper::getParams('com_componentbuilder'); - } - $filePath = self::$params->get($target, $default); - // check the file path (revert to default only of not a hidden file path) - if ('hiddenfilepath' !== $target && strpos($filePath, JPATH_SITE) === false) - { - $filePath = $default; - } - // create the folder if it does not exist - if ($createIfNotSet && !Folder::exists($filePath)) - { - Folder::create($filePath); - } - // setup the file name - $fileName = ''; - // Get basic key - $basickey = 'Th!s_iS_n0t_sAfe_buT_b3tter_then_n0thiug'; - if (method_exists(get_called_class(), "getCryptKey")) - { - $basickey = self::getCryptKey('basic', $basickey); - } - // check the key - if (!self::checkString($key)) - { - $key = 'vDm'; - } - // set the file name - if (self::checkString($fileType)) - { - // set the name - $fileName = trim(md5($type.$target.$basickey.$key) . '.' . trim($fileType, '.')); - } - else - { - $fileName = trim(md5($type.$target.$basickey.$key)) . '.txt'; - } - // return the url - if ('url' === $type) - { - if (strpos($filePath, JPATH_SITE) !== false) - { - $filePath = trim( str_replace( JPATH_SITE, '', $filePath), '/'); - return JURI::root() . $filePath . '/' . $fileName; - } - // since the path is behind the root folder of the site, return only the root url (may be used to build the link) - return JURI::root(); - } - // sanitize the path - return '/' . trim( $filePath, '/' ) . '/' . $fileName; - } - - /** * Get the file path or url * @@ -4326,59 +3785,6 @@ abstract class ComponentbuilderHelper } - /** - * get the content of a file - * - * @param string $path The path to the file - * @param string/bool $none The return value if no content was found - * - * @return string On success - * - */ - public static function getFileContents($path, $none = '') - { - if (self::checkString($path)) - { - // use basic file get content for now - if (($content = @file_get_contents($path)) !== FALSE) - { - return $content; - } - // use curl if available - elseif (function_exists('curl_version')) - { - // start curl - $ch = curl_init(); - // set the options - $options = array(); - $options[CURLOPT_URL] = $path; - $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; - $options[CURLOPT_RETURNTRANSFER] = TRUE; - $options[CURLOPT_SSL_VERIFYPEER] = FALSE; - // load the options - curl_setopt_array($ch, $options); - // get the content - $content = curl_exec($ch); - // close the connection - curl_close($ch); - // return if found - if (self::checkString($content)) - { - return $content; - } - } - elseif (property_exists('ComponentbuilderHelper', 'curlErrorLoaded') && !self::$curlErrorLoaded) - { - // set the notice - JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP'), 'Error'); - // load this notice only once - self::$curlErrorLoaded = true; - } - } - return $none; - } - - /** * the Crypt objects **/ @@ -4914,85 +4320,6 @@ abstract class ComponentbuilderHelper } - /** - * bc math wrapper (very basic not for accounting) - * - * @param string $type The type bc math - * @param int $val1 The first value - * @param int $val2 The second value - * @param int $scale The scale value - * - * @return int - * - */ - public static function bcmath($type, $val1, $val2, $scale = 0) - { - // build function name - $function = 'bc' . $type; - // use the bcmath function if available - if (function_exists($function)) - { - return $function($val1, $val2, $scale); - } - // if function does not exist we use +-*/ operators (fallback - not ideal) - switch ($type) - { - // Multiply two numbers - case 'mul': - return (string) round($val1 * $val2, $scale); - break; - // Divide of two numbers - case 'div': - return (string) round($val1 / $val2, $scale); - break; - // Adding two numbers - case 'add': - return (string) round($val1 + $val2, $scale); - break; - // Subtract one number from the other - case 'sub': - return (string) round($val1 - $val2, $scale); - break; - // Raise an arbitrary precision number to another - case 'pow': - return (string) round(pow($val1, $val2), $scale); - break; - // Compare two arbitrary precision numbers - case 'comp': - return (round($val1,2) == round($val2,2)); - break; - } - return false; - } - - /** - * Basic sum of an array with more precision - * - * @param array $array The values to sum - * @param int $scale The scale value - * - * @return float - * - */ - public static function bcsum($array, $scale = 4) - { - // use the bcadd function if available - if (function_exists('bcadd')) - { - // set the start value - $value = 0.0; - // loop the values and run bcadd - foreach($array as $val) - { - $value = bcadd($value, $val, $scale); - } - return $value; - } - // fall back on array sum - return array_sum($array); - } - - /** * the locker * @@ -6872,57 +6199,6 @@ abstract class ComponentbuilderHelper return self::$composer[$target]; } - /** - * Convert it into a string - */ - public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') - { - // do some table foot work - $external = false; - if (strpos($table, '#__') !== false) - { - $external = true; - $table = str_replace('#__', '', $table); - } - // check if string is JSON - $result = json_decode($value, true); - if (json_last_error() === JSON_ERROR_NONE) - { - // is JSON - if (self::checkArray($result)) - { - if (self::checkString($table)) - { - $names = array(); - foreach ($result as $val) - { - if ($external) - { - if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) - { - $names[] = $_name; - } - } - else - { - if ($_name = self::getVar($table, $val, $id, $name)) - { - $names[] = $_name; - } - } - } - if (self::checkArray($names)) - { - return (string) implode($sperator,$names); - } - } - return (string) implode($sperator,$result); - } - return (string) json_decode($value); - } - return $value; - } - /** * Load the Component xml manifest. */ @@ -7518,129 +6794,6 @@ abstract class ComponentbuilderHelper return false; } - /** - * 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 - * - */ - public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'componentbuilder') - { - if(!$where) - { - $where = JFactory::getUser()->id; - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#__'.$main.'_'.$table)); - } - if (is_numeric($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); - } - elseif (is_string($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); - } - else - { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); - } - return false; - } - - /** - * 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 - * - */ - public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'componentbuilder', $unique = true) - { - if(!$where) - { - $where = JFactory::getUser()->id; - } - - if (!self::checkArray($where) && $where > 0) - { - $where = array($where); - } - - if (self::checkArray($where)) - { - // prep main <-- why? well if $main='' is empty then $table can be categories or users - if (self::checkString($main)) - { - $main = '_'.ltrim($main, '_'); - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#_'.$main.'_'.$table)); - } - // add strings to array search - if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) - { - $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); - } - else - { - $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - if ($unique) - { - return array_unique($db->loadColumn()); - } - return $db->loadColumn(); - } - } - return false; - } - public static function isPublished($id,$type) { if ($type == 'raw') @@ -7878,83 +7031,6 @@ abstract class ComponentbuilderHelper return true; } - /** - * Check if have an json string - * - * @input string The json string to check - * - * @returns bool true on success - */ - public static function checkJson($string) - { - if (self::checkString($string)) - { - json_decode($string); - return (json_last_error() === JSON_ERROR_NONE); - } - return false; - } - - /** - * Check if have an object with a length - * - * @input object The object to check - * - * @returns bool true on success - */ - public static function checkObject($object) - { - if (isset($object) && is_object($object)) - { - return count((array)$object) > 0; - } - return false; - } - - /** - * Check if have an array with a length - * - * @input array The array to check - * - * @returns bool/int number of items in array on success - */ - public static function checkArray($array, $removeEmptyString = false) - { - if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) - { - // also make sure the empty strings are removed - if ($removeEmptyString) - { - foreach ($array as $key => $string) - { - if (empty($string)) - { - unset($array[$key]); - } - } - return self::checkArray($array, false); - } - return $nr; - } - return false; - } - - /** - * Check if have a string with a length - * - * @input string The string to check - * - * @returns bool true on success - */ - public static function checkString($string) - { - if (isset($string) && is_string($string) && strlen($string) > 0) - { - return true; - } - return false; - } - /** * Check if we are connected * Thanks https://stackoverflow.com/a/4860432/1429677 @@ -7980,345 +7056,12 @@ abstract class ComponentbuilderHelper return $is_conn; } - /** - * Merge an array of array's - * - * @input array The arrays you would like to merge - * - * @returns array on success - */ - public static function mergeArrays($arrays) - { - if(self::checkArray($arrays)) - { - $arrayBuket = array(); - foreach ($arrays as $array) - { - if (self::checkArray($array)) - { - $arrayBuket = array_merge($arrayBuket, $array); - } - } - return $arrayBuket; - } - return false; - } - // 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 - */ - public static function shorten($string, $length = 40, $addTip = true) - { - if (self::checkString($string)) - { - $initial = strlen($string); - $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); - $words_count = count((array)$words); - - $word_length = 0; - $last_word = 0; - for (; $last_word < $words_count; ++$last_word) - { - $word_length += strlen($words[$last_word]); - if ($word_length > $length) - { - break; - } - } - - $newString = implode(array_slice($words, 0, $last_word)); - $final = strlen($newString); - if ($initial != $final && $addTip) - { - $title = self::shorten($string, 400 , false); - return ''.trim($newString).'...'; - } - elseif ($initial != $final && !$addTip) - { - return trim($newString).'...'; - } - } - return $string; - } - - /** - * Making strings safe (various ways) - * - * @input string The you would like to make safe - * - * @returns string on success - */ - public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) - { - if ($replaceNumbers === true) - { - // remove all numbers and replace with english text version (works well only up to millions) - $string = self::replaceNumbers($string); - } - // 0nly continue if we have a string - if (self::checkString($string)) - { - // create file name without the extention that is safe - if ($type === 'filename') - { - // make sure VDM is not in the string - $string = str_replace('VDM', 'vDm', $string); - // Remove anything which isn't a word, whitespace, number - // or any of the following caracters -_() - // If you don't need to handle multi-byte characters - // you can use preg_replace rather than mb_ereg_replace - // Thanks @Łukasz Rysiak! - // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); - $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); - // http://stackoverflow.com/a/2021729/1429677 - return preg_replace('/\s+/', ' ', $string); - } - // remove all other characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters - if ($keepOnlyCharacters) - { - $string = preg_replace("/[^A-Za-z ]/", '', $string); - } - // keep both numbers and characters - else - { - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - } - // select final adaptations - if ($type === 'L' || $type === 'strtolower') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // default is to return lower - return strtolower($string); - } - elseif ($type === 'W') - { - // return a string with all first letter of each word uppercase(no undersocre) - return ucwords(strtolower($string)); - } - elseif ($type === 'w' || $type === 'word') - { - // return a string with all lowercase(no undersocre) - return strtolower($string); - } - elseif ($type === 'Ww' || $type === 'Word') - { - // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) - return ucfirst(strtolower($string)); - } - elseif ($type === 'WW' || $type === 'WORD') - { - // return a string with all the uppercase(no undersocre) - return strtoupper($string); - } - elseif ($type === 'U' || $type === 'strtoupper') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return all upper - return strtoupper($string); - } - elseif ($type === 'F' || $type === 'ucfirst') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return with first caracter to upper - return ucfirst(strtolower($string)); - } - elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') - { - // convert all words to first letter uppercase - $string = ucwords(strtolower($string)); - // remove white space - $string = preg_replace('/\s+/', '', $string); - // now return first letter lowercase - return lcfirst($string); - } - // return string - return $string; - } - // not a string - return ''; - } - - public static function transliterate($string) - { - // set tag only once - if (!self::checkString(self::$langTag)) - { - // get global value - self::$langTag = JComponentHelper::getParams('com_componentbuilder')->get('language', 'en-GB'); - } - // Transliterate on the language requested - $lang = Language::getInstance(self::$langTag); - return $lang->transliterate($string); - } - - public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) - { - if (self::checkString($var)) - { - $filter = new JFilterInput(); - $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); - if ($shorten) - { - return self::shorten($string,$length); - } - return $string; - } - else - { - return ''; - } - } - - public static function replaceNumbers($string) - { - // set numbers array - $numbers = array(); - // first get all numbers - preg_match_all('!\d+!', $string, $numbers); - // check if we have any numbers - if (isset($numbers[0]) && self::checkArray($numbers[0])) - { - foreach ($numbers[0] as $number) - { - $searchReplace[$number] = self::numberToString((int)$number); - } - // now replace numbers in string - $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); - // check if we missed any, strange if we did. - return self::replaceNumbers($string); - } - // return the string with no numbers remaining. - return $string; - } - - /** - * Convert an integer into an English word string - * Thanks to Tom Nicholson - * - * @input an int - * @returns a string - */ - public static function numberToString($x) - { - $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", - "eight", "nine", "ten", "eleven", "twelve", "thirteen", - "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", - "nineteen", "twenty", 30 => "thirty", 40 => "forty", - 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", - 90 => "ninety" ); - - if(!is_numeric($x)) - { - $w = $x; - } - elseif(fmod($x, 1) != 0) - { - $w = $x; - } - else - { - if($x < 0) - { - $w = 'minus '; - $x = -$x; - } - else - { - $w = ''; - // ... now $x is a non-negative integer. - } - - if($x < 21) // 0 to 20 - { - $w .= $nwords[$x]; - } - elseif($x < 100) // 21 to 99 - { - $w .= $nwords[10 * floor($x/10)]; - $r = fmod($x, 10); - if($r > 0) - { - $w .= ' '. $nwords[$r]; - } - } - elseif($x < 1000) // 100 to 999 - { - $w .= $nwords[floor($x/100)] .' hundred'; - $r = fmod($x, 100); - if($r > 0) - { - $w .= ' and '. self::numberToString($r); - } - } - elseif($x < 1000000) // 1000 to 999999 - { - $w .= self::numberToString(floor($x/1000)) .' thousand'; - $r = fmod($x, 1000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - else // millions - { - $w .= self::numberToString(floor($x/1000000)) .' million'; - $r = fmod($x, 1000000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - } - return $w; - } - - /** - * Random Key - * - * @returns a string - */ - public static function randomkey($size) - { - $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; - $key = array(); - $bagsize = strlen($bag) - 1; - for ($i = 0; $i < $size; $i++) - { - $get = rand(0, $bagsize); - $key[] = $bag[$get]; - } - return implode($key); - } - /** * Get The Encryption Keys * diff --git a/site/views/api/view.html.php b/site/views/api/view.html.php index 06e459df6..d5dd20094 100644 --- a/site/views/api/view.html.php +++ b/site/views/api/view.html.php @@ -88,10 +88,10 @@ class ComponentbuilderViewApi extends JViewLegacy { // set help url for this view if found - $help_url = ComponentbuilderHelper::getHelpUrl('api'); - if (ComponentbuilderHelper::checkString($help_url)) + $this->help_url = ComponentbuilderHelper::getHelpUrl('api'); + if (ComponentbuilderHelper::checkString($this->help_url)) { - JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url); } // now initiate the toolbar $this->toolbar = JToolbar::getInstance();