diff --git a/CHANGELOG.md b/CHANGELOG.md index 80039ba..d379fd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ -# v3.1.3-alpha1 +# v3.1.3-alpha2 -- Improve the removeFolder method in the install script +- Improve the PHP environment setup validation +- Add option to pass shared session via tag share # v3.1.3-alpha - Refactored the API classes -- Add table schema checker +- Add table schema checker +- Improve the removeFolder method in the install script # v3.1.1 diff --git a/README.md b/README.md index b628c41..2be3395 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (3.1.3-alpha1) +# Get Bible (3.1.3-alpha2) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 15th July, 2024 -+ *Version*: 3.1.3-alpha1 ++ *Last Build*: 29th July, 2024 ++ *Version*: 3.1.3-alpha2 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**626 Hours** or **78 Eight Hour Days** (actual time the author saved - +**648 Hours** or **81 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **224160** -+ *File count*: **1896** -+ *Folder count*: **154** ++ *Line count*: **232257** ++ *File count*: **1944** ++ *Folder count*: **156** -**412 Hours** or **52 Eight Hour Days** (the actual time the author spent) +**427 Hours** or **53 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @156hours** = codingtime / 4; -> **planning @89hours** = codingtime / 7; -> **mapping @63hours** = codingtime / 10; -> **office @104hours** = codingtime / 6;) +> **debugging @162hours** = codingtime / 4; +> **planning @93hours** = codingtime / 7; +> **mapping @65hours** = codingtime / 10; +> **office @108hours** = codingtime / 6;) -**1038 Hours** or **130 Eight Hour Days** +**1075 Hours** or **134 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **26 weeks** or **5.4 months** +Project duration: **26.8 weeks** or **5.6 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/README.txt b/admin/README.txt index b628c41..2be3395 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (3.1.3-alpha1) +# Get Bible (3.1.3-alpha2) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 15th July, 2024 -+ *Version*: 3.1.3-alpha1 ++ *Last Build*: 29th July, 2024 ++ *Version*: 3.1.3-alpha2 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**626 Hours** or **78 Eight Hour Days** (actual time the author saved - +**648 Hours** or **81 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **224160** -+ *File count*: **1896** -+ *Folder count*: **154** ++ *Line count*: **232257** ++ *File count*: **1944** ++ *Folder count*: **156** -**412 Hours** or **52 Eight Hour Days** (the actual time the author spent) +**427 Hours** or **53 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @156hours** = codingtime / 4; -> **planning @89hours** = codingtime / 7; -> **mapping @63hours** = codingtime / 10; -> **office @104hours** = codingtime / 6;) +> **debugging @162hours** = codingtime / 4; +> **planning @93hours** = codingtime / 7; +> **mapping @65hours** = codingtime / 10; +> **office @108hours** = codingtime / 6;) -**1038 Hours** or **130 Eight Hour Days** +**1075 Hours** or **134 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **26 weeks** or **5.4 months** +Project duration: **26.8 weeks** or **5.6 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/getbible.xml b/getbible.xml index bda4649..1f1c78f 100644 --- a/getbible.xml +++ b/getbible.xml @@ -1,15 +1,15 @@ COM_GETBIBLE - 15th July, 2024 + 29th July, 2024 Llewellyn van der Merwe joomla@vdm.io https://getbible.net Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 3.1.3-alpha1 + 3.1.3-alpha2 Get Bible (v.3.1.3-alpha1) +

Get Bible (v.3.1.3-alpha2)

Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide. diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Abstraction/Api.php b/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Abstraction/Api.php index 31ee77b..1af2613 100644 --- a/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Abstraction/Api.php +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Abstraction/Api.php @@ -15,6 +15,7 @@ namespace TrueChristianBible\Joomla\Gitea\Abstraction; use TrueChristianBible\Joomla\Gitea\Utilities\Http; use TrueChristianBible\Joomla\Gitea\Utilities\Uri; use TrueChristianBible\Joomla\Gitea\Utilities\Response; +use TrueChristianBible\Joomla\Interfaces\Git\ApiInterface; /** @@ -22,7 +23,7 @@ use TrueChristianBible\Joomla\Gitea\Utilities\Response; * * @since 3.2.0 */ -abstract class Api +abstract class Api implements ApiInterface { /** * The Http class diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Repository/Contents.php b/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Repository/Contents.php index 5fee209..73ce18c 100644 --- a/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Repository/Contents.php +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Repository/Contents.php @@ -12,6 +12,7 @@ namespace TrueChristianBible\Joomla\Gitea\Repository; +use TrueChristianBible\Joomla\Interfaces\Git\Repository\ContentsInterface; use TrueChristianBible\Joomla\Gitea\Abstraction\Api; @@ -20,7 +21,7 @@ use TrueChristianBible\Joomla\Gitea\Abstraction\Api; * * @since 3.2.0 */ -class Contents extends Api +class Contents extends Api implements ContentsInterface { /** * Get a file from a repository. @@ -345,20 +346,20 @@ class Contents extends Api /** * Delete a file in a repository. * - * @param string $owner The owner name. - * @param string $repo The repository name. - * @param string $filepath The file path. - * @param string $message The commit message. - * @param string $branch The branch name (optional). - * @param string $sha The blob SHA of the file. - * @param string $authorName The author name (optional). - * @param string $authorEmail The author email (optional). - * @param string $committerName The committer name (optional). - * @param string $committerEmail The committer email (optional). - * @param string $authorDate The author date (optional). - * @param string $committerDate The committer date (optional). - * @param string $newBranch The new branch name (optional). - * @param bool $signoff Add a Signed-off-by trailer (optional). + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $filepath The file path. + * @param string $message The commit message. + * @param string $sha The blob SHA of the file. + * @param string|null $branch The branch name (optional). + * @param string|null $authorName The author name (optional). + * @param string|null $authorEmail The author email (optional). + * @param string|null $committerName The committer name (optional). + * @param string|null $committerEmail The committer email (optional). + * @param string|null $authorDate The author date (optional). + * @param string|null $committerDate The committer date (optional). + * @param string|null $newBranch The new branch name (optional). + * @param bool|null $signoff Add a Signed-off-by trailer (optional). * * @return object|null * @since 3.2.0 @@ -449,7 +450,7 @@ class Contents extends Api // Send the delete request. return $this->response->get( $this->http->delete( - $this->uri->get($path), + $this->uri->get($path), [], null, json_encode($data) ) ); @@ -458,10 +459,10 @@ class Contents extends Api /** * Get the EditorConfig definitions of a file in a repository. * - * @param string $owner The owner name. - * @param string $repo The repository name. - * @param string $filepath The file path. - * @param string $ref The name of the commit/branch/tag. + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $filepath The file path. + * @param string|null $ref The name of the commit/branch/tag. * * @return string|null * @since 3.2.0 diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Utilities/Http.php b/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Utilities/Http.php index d0f9340..e000697 100644 --- a/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Utilities/Http.php +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea/src/Utilities/Http.php @@ -13,7 +13,9 @@ namespace TrueChristianBible\Joomla\Gitea\Utilities; use Joomla\CMS\Http\Http as JoomlaHttp; -use Joomla\Registry\Registry; +use Joomla\CMS\Uri\Uri; +use Joomla\Registry\Registry; + /** diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/ActiveRegistry.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/ActiveRegistry.php new file mode 100644 index 0000000..37b0f43 --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/ActiveRegistry.php @@ -0,0 +1,305 @@ + + * @git 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 TrueChristianBible\Joomla\Abstraction; + + +use TrueChristianBible\Joomla\Interfaces\Activeregistryinterface; + + +/** + * Active Storage Registry. + * + * Don't use this beyond 10 dimensional depth for best performance. + * + * @since 3.2.0 + */ +abstract class ActiveRegistry implements Activeregistryinterface +{ + /** + * The registry array. + * + * @var array + * @since 3.2.0 + **/ + protected array $active = []; + + /** + * Base switch to add values as string or array + * + * @var boolean + * @since 3.2.0 + **/ + protected bool $addAsArray = false; + + /** + * Base switch to keep array values unique + * + * @var boolean + * @since 3.2.2 + **/ + protected bool $uniqueArray = false; + + /** + * Check if the registry has any content. + * + * @return bool Returns true if the active array is not empty, false otherwise. + * @since 3.2.0 + */ + public function isActive(): bool + { + return !empty($this->active); + } + + /** + * Get all value from the active registry. + * + * @return array The values or empty array. + * @since 3.2.0 + */ + public function allActive(): array + { + return $this->active; + } + + /** + * Sets a value into the registry using multiple keys. + * + * @param mixed $value The value to set. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return void + * @since 3.2.0 + */ + public function setActive($value, string ...$keys): void + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to set any value."); + } + + $array = &$this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + if (!is_array($array)) + { + $path = '[' . implode('][', $keys) . ']'; + throw new \InvalidArgumentException("Attempted to use key '{$key}' on a non-array value: {$array}. Path: {$path} Value: {$value}"); + } + + $array[$key] = []; + } + $array = &$array[$key]; + } + + $array = $value; + } + + /** + * Adds content into the registry. If a key exists, + * it either appends or concatenates based on the value's type. + * + * @param mixed $value The value to set. + * @param bool|null $asArray Determines if the new value should be treated as an array. + * Default is $addAsArray = false (if null) in base class. + * Override in child class allowed set class property $addAsArray = true. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return void + * @since 3.2.0 + */ + public function addActive($value, ?bool $asArray, string ...$keys): void + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to add any value."); + } + + // null fallback to class value + if ($asArray === null) + { + $asArray = $this->addAsArray; + } + + $array = &$this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + if (!is_array($array)) + { + $path = '[' . implode('][', $keys) . ']'; + throw new \InvalidArgumentException("Attempted to use key '{$key}' on a non-array value: {$array}. Path: {$path} Value: {$value}"); + } + + $array[$key] = []; + } + $array = &$array[$key]; + } + + // add string + if (!$asArray && $array === []) + { + $array = ''; + } + + // Handle the adding logic at the tip of the array + if (is_array($array) || $asArray) + { + if (!is_array($array)) + { + // Convert to array if it's not already an array + $array = [$array]; + } + + if ($this->uniqueArray && in_array($value, $array)) + { + // we do nothing + return; + } + else + { + $array[] = $value; + } + } + else + { + if (is_string($value) || is_numeric($value)) + { + $array .= (string) $value; + } + else + { + $array = $value; + } + } + } + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param mixed $default The default value if not set. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function getActive($default, string ...$keys) + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to get any value."); + } + + $array = $this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return $default; + } + $array = $array[$key]; + } + + return $array; + } + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return void + * @since 3.2.0 + */ + public function removeActive(string ...$keys): void + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to remove any value."); + } + + $array = &$this->active; + $lastKey = array_pop($keys); + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return; // Exit early if the key doesn't exist + } + $array = &$array[$key]; + } + + unset($array[$lastKey]); + } + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function existsActive(string ...$keys): bool + { + if (!$this->validActiveKeys($keys)) + { + throw new \InvalidArgumentException("Keys must only be strings or numbers to check if any value exist."); + } + + $array = $this->active; + + foreach ($keys as $key) + { + if (!isset($array[$key])) + { + return false; + } + $array = $array[$key]; + } + + return true; + } + + /** + * Checks that the keys are valid + * + * @param array $keys The keys to determine the location. + * + * @return bool False if any of the keys are not a number or string. + * @since 3.2.0 + */ + protected function validActiveKeys(array $keys): bool + { + foreach ($keys as $key) + { + if ($key === '' || (!is_string($key) && !is_numeric($key))) + { + return false; + } + } + + return true; + } +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/PHPConfigurationChecker.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/PHPConfigurationChecker.php new file mode 100644 index 0000000..824eda2 --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/PHPConfigurationChecker.php @@ -0,0 +1,214 @@ + + * @git 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 TrueChristianBible\Joomla\Abstraction; + + +use Joomla\CMS\Factory; +use TrueChristianBible\Joomla\Interfaces\PHPConfigurationCheckerInterface; +use TrueChristianBible\Joomla\Abstraction\Registry; + + +/** + * PHP Configuration Checker + * + * @since 5.0.2 + */ +abstract class PHPConfigurationChecker extends Registry implements PHPConfigurationCheckerInterface +{ + /** + * The upload max filesize value + * + * @var string + * @since 5.0.2 + **/ + protected string $upload_max_filesize; + + /** + * The post max size value + * + * @var string + * @since 5.0.2 + **/ + protected string $post_max_size; + + /** + * The max execution time value + * + * @var int + * @since 5.0.2 + **/ + protected int $max_execution_time; + + /** + * The max input vars value + * + * @var int + * @since 5.0.2 + **/ + protected int $max_input_vars; + + /** + * The max input time value + * + * @var int + * @since 5.0.2 + **/ + protected int $max_input_time; + + /** + * The memory limit value + * + * @var string + * @since 5.0.2 + **/ + protected string $memory_limit; + + /** + * The registry array. + * + * @var array + * @since 5.0.2 + **/ + protected array $active = [ + 'php' => [ + 'upload_max_filesize' => [ + 'success' => 'The upload_max_filesize is appropriately set to handle large files, which is essential for uploading substantial components and media.', + 'warning' => 'The current upload_max_filesize may not support large file uploads effectively, potentially causing failures during component installation.' + ], + 'post_max_size' => [ + 'success' => 'The post_max_size setting is sufficient to manage large data submissions, ensuring smooth data processing within forms and uploads.', + 'warning' => 'An insufficient post_max_size can lead to truncated data submissions, affecting form functionality and data integrity.' + ], + 'max_execution_time' => [ + 'success' => 'Max execution time is set high enough to execute complex operations without premature termination, which is crucial for lengthy operations.', + 'warning' => 'A low max execution time could lead to script timeouts, especially during intensive operations, which might interrupt execution and cause failures during the compiling of a large extension.' + ], + 'max_input_vars' => [ + 'success' => 'The max_input_vars setting supports a high number of input variables, facilitating complex forms and detailed component configurations.', + 'warning' => 'Too few max_input_vars may result in lost data during processing complex forms, which can lead to incomplete configurations and operational issues.' + ], + 'max_input_time' => [ + 'success' => 'Max input time is adequate for processing inputs efficiently during high-load operations, ensuring no premature timeouts.', + 'warning' => 'An insufficient max input time could result in incomplete data processing during input-heavy operations, potentially leading to errors and data loss.' + ], + 'memory_limit' => [ + 'success' => 'The memory limit is set high to accommodate extensive operations and data processing, which enhances overall performance and stability.', + 'warning' => 'A low memory limit can lead to frequent crashes and performance issues, particularly when processing large amounts of data or complex calculations.' + ] + ], + 'environment' => [ + 'name' => 'extension environment', + 'objective' => 'These settings are crucial for ensuring the successful installation and stable functionality of the extension.', + 'wiki_name' => 'PHP Settings Wiki', + 'wiki_url' => '#' + ] + ]; + + /** + * Application object. + * + * @since 5.0.2 + **/ + protected $app; + + /** + * Constructor. + * + * @param $app The app object. + * + * @since 5.0.2 + */ + public function __construct($app = null) + { + $this->app = $app ?: Factory::getApplication(); + + // set the required PHP Configures + $this->set('php.upload_max_filesize.value', $this->upload_max_filesize); + $this->set('php.post_max_size.value', $this->post_max_size); + $this->set('php.max_execution_time.value', $this->max_execution_time); + $this->set('php.max_input_vars.value', $this->max_input_vars); + $this->set('php.max_input_time.value', $this->max_input_time); + $this->set('php.memory_limit.value', $this->memory_limit); + } + + /** + * Check that the required configurations are set for PHP + * + * @return void + * @since 5.0.2 + **/ + public function run(): void + { + $showHelp = false; + + // Check each configuration and provide detailed feedback + $configurations = $this->active['php'] ?? []; + foreach ($configurations as $configName => $configDetails) + { + $currentValue = ini_get($configName); + if ($currentValue === false) + { + $this->app->enqueueMessage("Error: Unable to retrieve current setting for '{$configName}'.", 'error'); + continue; + } + + $requiredValue = $configDetails['value'] ?? 0; + $isMemoryValue = strpbrk($requiredValue, 'KMG') !== false; + + $requiredValueBytes = $isMemoryValue ? $this->convertToBytes($requiredValue) : (int) $requiredValue; + $currentValueBytes = $isMemoryValue ? $this->convertToBytes($currentValue) : (int) $currentValue; + $conditionMet = $currentValueBytes >= $requiredValueBytes; + + $messageType = $conditionMet ? 'message' : 'warning'; + $messageText = $conditionMet ? + "Success: {$configName} is set to {$currentValue}. " . $configDetails['success'] ?? '': + "Warning: {$configName} configuration should be at least {$requiredValue} but is currently {$currentValue}. " . $configDetails['warning'] ?? ''; + + $showHelp = ($showHelp || $messageType === 'warning') ? true : false; + + $this->app->enqueueMessage($messageText, $messageType); + } + + if ($showHelp) + { + $this->app->enqueueMessage("To optimize your {$this->get('environment.name', 'extension')}, specific PHP settings must be enhanced.
{$this->get('environment.objective', '')}
We've identified that certain configurations currently do not meet the recommended standards.
To adjust these settings and prevent potential issues, please consult our detailed guide available at get('environment.wiki_url', '#')}\" target=\"_blank\">{$this->get('environment.wiki_name', 'PHP Settings Wiki')}.", 'notice'); + } + } + + /** + * Helper function to convert PHP INI memory values to bytes + * + * @param string $value The value to convert + * + * @return int The bytes value + * @since 5.0.2 + */ + protected function convertToBytes(string $value): int + { + $value = trim($value); + $lastChar = strtolower($value[strlen($value) - 1]); + $numValue = substr($value, 0, -1); + + switch ($lastChar) + { + case 'g': + return $numValue * 1024 * 1024 * 1024; + case 'm': + return $numValue * 1024 * 1024; + case 'k': + return $numValue * 1024; + default: + return (int) $value; + } + } +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/Registry.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/Registry.php new file mode 100644 index 0000000..8fe4cc0 --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/Registry.php @@ -0,0 +1,191 @@ + + * @git 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 TrueChristianBible\Joomla\Abstraction; + + +use TrueChristianBible\Joomla\Interfaces\Registryinterface; +use TrueChristianBible\Joomla\Abstraction\ActiveRegistry; + + +/** + * VDM Basic Registry. + * + * Don't use this beyond 10 dimensional depth for best performance. + * + * @since 3.2.0 + */ +abstract class Registry extends ActiveRegistry implements Registryinterface +{ + /** + * Path separator + * + * @var string|null + * @since 3.2.0 + */ + protected ?string $separator = '.'; + + /** + * Sets a value into the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $value Value of entry + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return self + * @since 3.2.0 + */ + public function set(string $path, $value): self + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to set any value."); + } + + $this->setActive($value, ...$keys); + + return $this; + } + + /** + * Adds content into the registry. If a key exists, + * it either appends or concatenates based on $asArray switch. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $value Value of entry + * @param bool|null $asArray Determines if the new value should be treated as an array. + * Default is $addAsArray = false (if null) in base class. + * Override in child class allowed set class property $addAsArray = true. + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return self + * @since 3.2.0 + */ + public function add(string $path, $value, ?bool $asArray = null): self + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to add any value."); + } + + $this->addActive($value, $asArray, ...$keys); + + return $this; + } + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $default Optional default value, returned if the internal doesn't exist. + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function get(string $path, $default = null) + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to get any value."); + } + + return $this->getActive($default, ...$keys); + } + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return self + * @since 3.2.0 + */ + public function remove(string $path): self + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to remove any value."); + } + + $this->removeActive(...$keys); + + return $this; + } + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function exists(string $path): bool + { + if (($keys = $this->getActiveKeys($path)) === null) + { + throw new \InvalidArgumentException("Path must only be strings or numbers to check if any value exist."); + } + + return $this->existsActive(...$keys); + } + + /** + * Sets a separator value + * + * @param string|null $value The value to set. + * + * @return self + * @since 3.2.0 + */ + public function setSeparator(?string $value): self + { + $this->separator = $value; + + return $this; + } + + /** + * Get that the active keys from a path + * + * @param string $path The path to determine the location registry. + * + * @return array|null The valid array of keys + * @since 3.2.0 + */ + protected function getActiveKeys(string $path): ?array + { + // empty path no allowed + if ($path === '') + { + return null; + } + + // Flatten the path + if ($this->separator === null || $this->separator === '') + { + return [$path]; + } + + $keys = array_values(array_filter(explode($this->separator, $path), 'strlen')); + + if (empty($keys)) + { + return null; + } + + return $keys; + } +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/Schema.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/Schema.php index 3db207a..6edf36c 100644 --- a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/Schema.php +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/Schema.php @@ -455,8 +455,8 @@ abstract class Schema implements SchemaInterface return true; } - if (is_string($expected['default']) && strtoupper($expected['default']) === 'EMPTY' && - is_string($current->Default) && strpos($current->Default, 'EMPTY') !== false) + if (isset($expected['default']) && is_string($expected['default']) && strtoupper($expected['default']) === 'EMPTY' && + isset($current->Default) && is_string($current->Default) && strpos($current->Default, 'EMPTY') !== false) { return true; // little fix } diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/SchemaChecker.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/SchemaChecker.php index 5180413..0d3a4e3 100644 --- a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/SchemaChecker.php +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Abstraction/SchemaChecker.php @@ -12,8 +12,7 @@ namespace TrueChristianBible\Joomla\Abstraction; -use Joomla\CMS\Factory; -use Joomla\CMS\Application\CMSApplication; +use Joomla\CMS\Factory; use TrueChristianBible\Joomla\Interfaces\SchemaInterface as Schema; use TrueChristianBible\Joomla\Interfaces\Tableinterface as Table; use TrueChristianBible\Joomla\Utilities\ClassHelper; @@ -46,22 +45,21 @@ abstract class SchemaChecker implements SchemaCheckerInterface /** * Application object. * - * @var CMSApplication * @since 3.2.2 **/ - protected CMSApplication $app; + protected $app; /** * Constructor. * - * @param Schema|null $schema The Schema Class. - * @param Table|null $table The Table Class. - * @param CMSApplication|null $app The app object. + * @param Schema|null $schema The Schema Class. + * @param Table|null $table The Table Class. + * @param $app The app object. * * @throws \Exception * @since 3.2.2 */ - public function __construct(?Schema $schema = null, ?Table $table = null, ?CMSApplication $app = null) + public function __construct(?Schema $schema = null, ?Table $table = null, $app = null) { $this->schema = $schema; $this->table = $table; diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/GetBible/PHPConfigurationChecker.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/GetBible/PHPConfigurationChecker.php new file mode 100644 index 0000000..b022105 --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/GetBible/PHPConfigurationChecker.php @@ -0,0 +1,88 @@ + + * @git 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 TrueChristianBible\Joomla\GetBible; + + +use TrueChristianBible\Joomla\Interfaces\PHPConfigurationCheckerInterface; +use TrueChristianBible\Joomla\Abstraction\PHPConfigurationChecker as ExtendingPHPConfigurationChecker; + + +/** + * Getbible PHP Configuration Checker + * + * @since 5.02 + */ +final class PHPConfigurationChecker extends ExtendingPHPConfigurationChecker implements PHPConfigurationCheckerInterface +{ + /** + * The upload max filesize value + * + * @var string + * @since 5.0.2 + **/ + protected string $upload_max_filesize = '64M'; + + /** + * The post max size value + * + * @var string + * @since 5.0.2 + **/ + protected string $post_max_size = '128M'; + + /** + * The max execution time value + * + * @var int + * @since 5.0.2 + **/ + protected int $max_execution_time = 60; + + /** + * The max input vars value + * + * @var int + * @since 5.0.2 + **/ + protected int $max_input_vars = 5000; + + /** + * The max input time value + * + * @var int + * @since 5.0.2 + **/ + protected int $max_input_time = 60; + + /** + * The memory limit value + * + * @var string + * @since 5.0.2 + **/ + protected string $memory_limit = '256M'; + + /** + * Constructor. + * + * @since 5.0.2 + */ + public function __construct($app = null) + { + parent::__construct($app); + + // set the required PHP Configures + $this->set('environment.name', 'Getbible environment'); + $this->set('environment.wiki_url', 'git.vdm.dev/getBible/support/wiki/PHP-Settings'); + } +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Activeregistryinterface.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Activeregistryinterface.php new file mode 100644 index 0000000..0b81aaa --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Activeregistryinterface.php @@ -0,0 +1,100 @@ + + * @git 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 TrueChristianBible\Joomla\Interfaces; + + +/** + * The Active Registry Interface + * + * @since 3.2.0 + */ +interface Activeregistryinterface +{ + /** + * Check if the registry has any content. + * + * @return bool Returns true if the active array is not empty, false otherwise. + * @since 3.2.0 + */ + public function isActive(): bool; + + /** + * Retrieves all value from the registry. + * + * @return array The values. + * @since 3.2.0 + */ + public function allActive(): array; + + /** + * Sets a value into the registry using multiple keys. + * + * @param mixed $value The value to set. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return void + * @since 3.2.0 + */ + public function setActive($value, string ...$keys): void; + + /** + * Adds content into the registry. If a key exists, + * it either appends or concatenates based on the value's type. + * + * @param mixed $value The value to set. + * @param bool|null $asArray Determines if the new value should be treated as an array. + * Default is $addAsArray = false (if null) in base class. + * Override in child class allowed set class property $addAsArray = true. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return void + * @since 3.2.0 + */ + public function addActive($value, ?bool $asArray, string ...$keys): void; + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param mixed $default The default value if not set. + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function getActive($default, string ...$keys); + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return void + * @since 3.2.0 + */ + public function removeActive(string ...$keys): void; + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string ...$keys The keys to determine the location. + * + * @throws \InvalidArgumentException If any of the keys are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function existsActive(string ...$keys): bool; +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/ApiInterface.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/ApiInterface.php new file mode 100644 index 0000000..23305a7 --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/ApiInterface.php @@ -0,0 +1,50 @@ + + * @git 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 TrueChristianBible\Joomla\Interfaces\Git; + + +/** + * The Git Api Interface + * + * @since 3.2.0 + */ +interface ApiInterface +{ + /** + * Load/Reload API. + * + * @param string|null $url The url. + * @param token|null $token The token. + * @param bool $backup The backup swapping switch. + * + * @return void + * @since 3.2.0 + **/ + public function load_(?string $url = null, ?string $token = null, bool $backup = true): void; + + /** + * Reset to previous toke, url it set + * + * @return void + * @since 3.2.0 + **/ + public function reset_(): void; + + /** + * Get the API url + * + * @return string + * @since 3.2.0 + **/ + public function api(); +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/Repository/ContentsInterface.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/Repository/ContentsInterface.php new file mode 100644 index 0000000..569d54b --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/Repository/ContentsInterface.php @@ -0,0 +1,209 @@ + + * @git 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 TrueChristianBible\Joomla\Interfaces\Git\Repository; + + +use TrueChristianBible\Joomla\Interfaces\Git\ApiInterface; + + +/** + * The Git Repository Contents Interface + * + * @since 3.2.2 + */ +interface ContentsInterface extends ApiInterface +{ + /** + * Get a file from a repository. + * + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $filepath The file path. + * @param string|null $ref Optional. The name of the commit/branch/tag. + * Default the repository's default branch (usually master). + * + * @return mixed + * @since 3.2.0 + **/ + public function get(string $owner, string $repo, string $filepath, ?string $ref = null); + + /** + * Get the metadata and contents (if a file) of an entry in a repository, + * or a list of entries if a directory. + * + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $filepath The file or directory path. + * @param string|null $ref Optional. The name of the commit/branch/tag. + * Default the repository's default branch (usually master). + * + * @return null|array|object + * @since 3.2.0 + **/ + public function metadata(string $owner, string $repo, string $filepath, ?string $ref = null): null|array|object; + + /** + * Create a file in a repository. + * + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $filepath The file path. + * @param string $content The file content. + * @param string $message The commit message. + * @param string $branch The branch name. Defaults to the repository's default branch. + * @param string|null $authorName The author's name. + * @param string|null $authorEmail The author's email. + * @param string|null $committerName The committer's name. + * @param string|null $committerEmail The committer's email. + * @param string|null $newBranch Whether to create a new branch. Defaults to null. + * @param string|null $authorDate The author's date. + * @param string|null $committerDate The committer's date. + * @param bool|null $signoff Add a Signed-off-by trailer. Defaults to null. + * + * @return object|null + * @since 3.2.0 + **/ + public function create( + string $owner, + string $repo, + string $filepath, + string $content, + string $message, + string $branch = 'master', + ?string $authorName = null, + ?string $authorEmail = null, + ?string $committerName = null, + ?string $committerEmail = null, + ?string $newBranch = null, + ?string $authorDate = null, + ?string $committerDate = null, + ?bool $signoff = null + ): ?object; + + /** + * Get the metadata of all the entries of the root directory. + * + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string|null $ref The name of the commit/branch/tag. Default the repository's default branch (usually master). + * + * @return array|null + * @since 3.2.0 + **/ + public function root(string $owner, string $repo, ?string $ref = null): ?array; + + /** + * Update a file in a repository. + * + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $filepath The file path. + * @param string $content The file content. + * @param string $message The commit message. + * @param string $sha The blob SHA of the file. + * @param string $branch The branch name. Defaults to the repository's default branch. + * @param string|null $authorName The author name. Defaults to the authenticated user. + * @param string|null $authorEmail The author email. Defaults to the authenticated user. + * @param string|null $committerName The committer name. Defaults to the authenticated user. + * @param string|null $committerEmail The committer email. Defaults to the authenticated user. + * @param string|null $authorDate The author date. + * @param string|null $committerDate The committer date. + * @param string|null $fromPath The original file path to move/rename. + * @param string|null $newBranch The new branch to create from the specified branch. + * @param bool|null $signoff Add a Signed-off-by trailer. + * + * @return object|null + * @since 3.2.0 + **/ + public function update( + string $owner, + string $repo, + string $filepath, + string $content, + string $message, + string $sha, + string $branch = 'master', + ?string $authorName = null, + ?string $authorEmail = null, + ?string $committerName = null, + ?string $committerEmail = null, + ?string $authorDate = null, + ?string $committerDate = null, + ?string $fromPath = null, + ?string $newBranch = null, + ?bool $signoff = null + ): ?object; + + /** + * Delete a file in a repository. + * + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $filepath The file path. + * @param string $message The commit message. + * @param string $sha The blob SHA of the file. + * @param string|null $branch The branch name (optional). + * @param string|null $authorName The author name (optional). + * @param string|null $authorEmail The author email (optional). + * @param string|null $committerName The committer name (optional). + * @param string|null $committerEmail The committer email (optional). + * @param string|null $authorDate The author date (optional). + * @param string|null $committerDate The committer date (optional). + * @param string|null $newBranch The new branch name (optional). + * @param bool|null $signoff Add a Signed-off-by trailer (optional). + * + * @return object|null + * @since 3.2.0 + **/ + public function delete( + string $owner, + string $repo, + string $filepath, + string $message, + string $sha, + ?string $branch = null, + ?string $authorName = null, + ?string $authorEmail = null, + ?string $committerName = null, + ?string $committerEmail = null, + ?string $authorDate = null, + ?string $committerDate = null, + ?string $newBranch = null, + ?bool $signoff = null + ): ?object; + + /** + * Get the EditorConfig definitions of a file in a repository. + * + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $filepath The file path. + * @param string|null $ref The name of the commit/branch/tag. + * + * @return string|null + * @since 3.2.0 + **/ + public function editor(string $owner, string $repo, string $filepath, string $ref = null): ?string; + + /** + * Get the blob of a repository. + * + * @param string $owner The owner name. + * @param string $repo The repository name. + * @param string $sha The SHA hash of the blob. + * + * @return object|null + * @since 3.2.0 + **/ + public function blob(string $owner, string $repo, string $sha): ?object; +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/Repository/index.html b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/Repository/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/Repository/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/index.html b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Git/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/PHPConfigurationCheckerInterface.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/PHPConfigurationCheckerInterface.php new file mode 100644 index 0000000..2ee3bf0 --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/PHPConfigurationCheckerInterface.php @@ -0,0 +1,30 @@ + + * @git 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 TrueChristianBible\Joomla\Interfaces; + + +/** + * PHP Configuration Checker + * + * @since 5.0.2 + */ +interface PHPConfigurationCheckerInterface +{ + /** + * Check that the required configurations are set for PHP + * + * @return void + * @since 5.0.2 + **/ + public function run(): void; +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Registryinterface.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Registryinterface.php new file mode 100644 index 0000000..160e2cb --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Interfaces/Registryinterface.php @@ -0,0 +1,97 @@ + + * @git 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 TrueChristianBible\Joomla\Interfaces; + + +use TrueChristianBible\Joomla\Interfaces\Activeregistryinterface; + + +/** + * The Registry Interface + * + * @since 3.2.0 + */ +interface Registryinterface extends Activeregistryinterface +{ + /** + * Sets a value into the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $value Value of entry + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return self + * @since 3.2.0 + */ + public function set(string $path, $value): self; + + /** + * Adds content into the registry. If a key exists, + * it either appends or concatenates based on $asArray switch. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $value Value of entry + * @param bool|null $asArray Determines if the new value should be treated as an array. + * Default is $addAsArray = false (if null) in base class. + * Override in child class allowed set class property $addAsArray = true. + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return self + * @since 3.2.0 + */ + public function add(string $path, $value, ?bool $asArray = null): self; + + /** + * Retrieves a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * @param mixed $default Optional default value, returned if the internal doesn't exist. + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return mixed The value or sub-array from the storage. Null if the location doesn't exist. + * @since 3.2.0 + */ + public function get(string $path, $default = null); + + /** + * Removes a value (or sub-array) from the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return self + * @since 3.2.0 + */ + public function remove(string $path): self; + + /** + * Checks the existence of a particular location in the registry using multiple keys. + * + * @param string $path Registry path (e.g. vdm.content.builder) + * + * @throws \InvalidArgumentException If any of the path values are not a number or string. + * @return bool True if the location exists, false otherwise. + * @since 3.2.0 + */ + public function exists(string $path): bool; + + /** + * Sets a separator value + * + * @param string|null $value The value to set. + * + * @return self + * @since 3.2.0 + */ + public function setSeparator(?string $value): self; +} + diff --git a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Model/Load.php b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Model/Load.php index 51729db..7068eb4 100644 --- a/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Model/Load.php +++ b/libraries/vendor_getbible/TrueChristianBible.Joomla/src/Model/Load.php @@ -45,8 +45,8 @@ final class Load extends Model implements ModelInterface $table = $this->getTable(); } - // check if this is a valid table - if (($store = $this->table->get($table, $field, 'store')) !== null) + // check if this is a valid table (don't touch null) + if ($value !== null && ($store = $this->table->get($table, $field, 'store')) !== null) { // open the value based on the store method switch($store) diff --git a/script.php b/script.php index 8da9230..92d4712 100644 --- a/script.php +++ b/script.php @@ -25,11 +25,14 @@ use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Installer\Adapter\ComponentAdapter; use Joomla\CMS\Version; use Joomla\CMS\HTML\HTMLHelper as Html; +use TrueChristianBible\Joomla\GetBible\PHPConfigurationChecker; use TrueChristianBible\Joomla\GetBible\Table\SchemaChecker; HTML::_('bootstrap.renderModal'); /** * Script File of Getbible Component + * + * @since 1.5.0 */ class Com_GetbibleInstallerScript { @@ -37,6 +40,7 @@ class Com_GetbibleInstallerScript * Constructor * * @param ComponentAdapter $parent The object responsible for running this script + * @since 1.5.0 */ public function __construct(ComponentAdapter $parent) {} @@ -46,6 +50,7 @@ class Com_GetbibleInstallerScript * @param ComponentAdapter $parent The object responsible for running this script * * @return boolean True on success + * @since 1.5.0 */ public function install(ComponentAdapter $parent) {} @@ -53,6 +58,8 @@ class Com_GetbibleInstallerScript * Called on uninstallation * * @param ComponentAdapter $parent The object responsible for running this script + * + * @since 1.5.0 */ public function uninstall(ComponentAdapter $parent) { @@ -957,6 +964,7 @@ class Com_GetbibleInstallerScript * @param ComponentAdapter $parent The object responsible for running this script * * @return boolean True on success + * @since 1.5.0 */ public function update(ComponentAdapter $parent){} @@ -967,6 +975,7 @@ class Com_GetbibleInstallerScript * @param ComponentAdapter $parent The object responsible for running this script * * @return boolean True on success + * @since 1.5.0 */ public function preflight($type, ComponentAdapter $parent) { @@ -1000,8 +1009,11 @@ class Com_GetbibleInstallerScript return false; } - // Check that the required configuration are set for PHP - $this->phpConfigurationCheck($app); + // Check that the PHP configurations are sufficient + if ($this->classExists(PHPConfigurationChecker::class)) + { + (new PHPConfigurationChecker())->run(); + } // all things to clear out $removeFolders = []; @@ -1021,8 +1033,11 @@ class Com_GetbibleInstallerScript if ($type === 'install') { - // Check that the required configuration are set for PHP - $this->phpConfigurationCheck($app); + // Check that the PHP configurations are sufficient + if ($this->classExists(PHPConfigurationChecker::class)) + { + (new PHPConfigurationChecker())->run(); + } } // check if the PHPExcel stuff is still around if (File::exists(JPATH_ADMINISTRATOR . '/components/com_getbible/helpers/PHPExcel.php')) @@ -1042,6 +1057,7 @@ class Com_GetbibleInstallerScript * @param ComponentAdapter $parent The object responsible for running this script * * @return boolean True on success + * @since 1.5.0 */ public function postflight($type, ComponentAdapter $parent) { @@ -1581,7 +1597,7 @@ class Com_GetbibleInstallerScript echo '

-

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

'; +

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

'; // Set db if not set already. if (!isset($db)) @@ -2024,11 +2040,11 @@ class Com_GetbibleInstallerScript * @param array|null $ignore The folders and files to ignore and not remove. * * @return bool True if all specified files/folders are removed, false otherwise. - * @since 3.2.2 + * @since 3.2.2 */ protected function removeFolder(string $dir, ?array $ignore = null): bool { - if (!Folder::exists($dir)) + if (!is_dir($dir)) { return false; } @@ -2075,7 +2091,7 @@ class Com_GetbibleInstallerScript * @param array $ignore The folders and files to ignore. * * @return bool True if the directory is empty or contains only ignored items, false otherwise. - * @since 3.2.1 + * @since 3.2.1 */ protected function isDirEmpty(string $dir, array $ignore): bool { @@ -2097,7 +2113,7 @@ class Com_GetbibleInstallerScript * @input array The array to check * * @returns bool/int number of items in array on success - * @since 3.2.2 + * @since 3.2.2 */ protected function checkArray($array, $removeEmptyString = false) { @@ -2127,134 +2143,35 @@ class Com_GetbibleInstallerScript * @param string $className The fully qualified name of the class to check. * * @return bool True if the class exists or was successfully loaded, false otherwise. - * @since 3.2.2 + * @since 3.2.2 */ protected function classExists(string $className): bool { - if (!class_exists($className, true)) + if (class_exists($className, true)) { - // The power autoloader for this project (JPATH_ADMINISTRATOR) area. - $power_autoloader = JPATH_ADMINISTRATOR . '/components/com_getbible/helpers/powerloader.php'; - if (file_exists($power_autoloader)) - { - require_once $power_autoloader; - } + return true; + } - // Check again if the class now exists after requiring the autoloader - if (!class_exists($className, true)) + // Autoloaders to check + $autoloaders = [ + __DIR__ . '/script_powerloader.php', + JPATH_ADMINISTRATOR . '/components/com_getbible/helpers/powerloader.php' + ]; + + foreach ($autoloaders as $autoloader) + { + if (file_exists($autoloader)) { - return false; + require_once $autoloader; + + if (class_exists($className, true)) + { + return true; + } } } - return true; - } - /** - * Define the required limits with specific messages for success and warning scenarios - * - * @var array - * @since 3.0.8 - */ - protected array $requiredPHPConfigs = [ - 'upload_max_filesize' => [ - 'value' => '64M', - 'success' => 'The upload_max_filesize is appropriately set to handle large files, which is essential for uploading substantial components and media.', - 'warning' => 'The current upload_max_filesize may not support large file uploads effectively, potentially causing failures during component installation.' - ], - 'post_max_size' => [ - 'value' => '128M', - 'success' => 'The post_max_size setting is sufficient to manage large data submissions, ensuring smooth data processing within forms and uploads.', - 'warning' => 'An insufficient post_max_size can lead to truncated data submissions, affecting form functionality and data integrity.' - ], - 'max_execution_time' => [ - 'value' => 60, - 'success' => 'Max execution time is set high enough to execute complex operations without premature termination, which is crucial for lengthy operations.', - 'warning' => 'A low max execution time could lead to script timeouts, especially during intensive operations, which might interrupt execution and cause failures during the compiling of a large extension.' - ], - 'max_input_vars' => [ - 'value' => 5000, - 'success' => 'The max_input_vars setting supports a high number of input variables, facilitating complex forms and detailed component configurations.', - 'warning' => 'Too few max_input_vars may result in lost data during processing complex forms, which can lead to incomplete configurations and operational issues.' - ], - 'max_input_time' => [ - 'value' => 60, - 'success' => 'Max input time is adequate for processing inputs efficiently during high-load operations, ensuring no premature timeouts.', - 'warning' => 'An insufficient max input time could result in incomplete data processing during input-heavy operations, potentially leading to errors and data loss.' - ], - 'memory_limit' => [ - 'value' => '256M', - 'success' => 'The memory limit is set high to accommodate extensive operations and data processing, which enhances overall performance and stability.', - 'warning' => 'A low memory limit can lead to frequent crashes and performance issues, particularly when processing large amounts of data or complex calculations.' - ] - ]; - - /** - * Helper function to convert PHP INI memory values to bytes - * - * @param string $value The value to convert - * - * @return int The bytes value - * @since 3.0.8 - */ - protected function convertToBytes(string $value): int - { - $value = trim($value); - $lastChar = strtolower($value[strlen($value) - 1]); - $numValue = substr($value, 0, -1); - - switch ($lastChar) - { - case 'g': - return $numValue * 1024 * 1024 * 1024; - case 'm': - return $numValue * 1024 * 1024; - case 'k': - return $numValue * 1024; - default: - return (int) $value; - } - } - - /** - * Check that the required configurations are set for PHP - * - * @param $app The application - * - * @return void - * @since 3.0.8 - */ - protected function phpConfigurationCheck($app): void - { - $showHelp = false; - - // Check each configuration and provide detailed feedback - foreach ($this->requiredPHPConfigs as $configName => $configDetails) - { - $currentValue = ini_get($configName); - if ($currentValue === false) - { - $app->enqueueMessage("Error: Unable to retrieve current setting for '{$configName}'.", 'error'); - continue; - } - - $isMemoryValue = strpbrk($configDetails['value'], 'KMG') !== false; - $requiredValueBytes = $isMemoryValue ? $this->convertToBytes($configDetails['value']) : (int) $configDetails['value']; - $currentValueBytes = $isMemoryValue ? $this->convertToBytes($currentValue) : (int) $currentValue; - $conditionMet = $currentValueBytes >= $requiredValueBytes; - - $messageType = $conditionMet ? 'message' : 'warning'; - $messageText = $conditionMet ? - "Success: {$configName} is set to {$currentValue}. " . $configDetails['success'] : - "Warning: {$configName} configuration should be at least {$configDetails['value']} but is currently {$currentValue}. " . $configDetails['warning']; - $showHelp = ($showHelp || $messageType === 'warning') ? true : false; - $app->enqueueMessage($messageText, $messageType); - } - - if ($showHelp) - { - $app->enqueueMessage('To optimize your Get Bible environment, specific PHP settings must be enhanced.
These settings are crucial for ensuring the successful installation and stable functionality of the extension.
We\'ve identified that certain configurations currently do not meet the recommended standards.
To adjust these settings and prevent potential issues, please consult our detailed guide available at Get Bible PHP Settings Wiki. -', 'notice'); - } + return false; } /** diff --git a/script_powerloader.php b/script_powerloader.php new file mode 100644 index 0000000..3f0f764 --- /dev/null +++ b/script_powerloader.php @@ -0,0 +1,64 @@ + + @git Get Bible + @github Get Bible + @support Get Bible + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die; + +// register additional namespace +spl_autoload_register(function ($class) { + // project-specific base directories and namespace prefix + $search = [ + 'libraries/vendor_getbible/TrueChristianBible.Joomla.Openai' => 'TrueChristianBible\\Joomla\\Openai', + 'libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea' => 'TrueChristianBible\\Joomla\\Gitea', + 'libraries/vendor_getbible/TrueChristianBible.Joomla' => 'TrueChristianBible\\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) + { + // not found so 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 = __DIR__ . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); diff --git a/site/controller.php b/site/controller.php index c7d3429..cc5a3d7 100644 --- a/site/controller.php +++ b/site/controller.php @@ -85,7 +85,7 @@ class GetbibleController extends BaseController if (StringHelper::check($view)) { $views = array( - + '' ); // check if this is a edit view if (in_array($view,$views)) diff --git a/site/models/tag.php b/site/models/tag.php index ba63276..e11e32e 100644 --- a/site/models/tag.php +++ b/site/models/tag.php @@ -26,11 +26,11 @@ use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; use Joomla\CMS\Helper\TagsHelper; use TrueChristianBible\Joomla\Utilities\StringHelper; +use TrueChristianBible\Joomla\GetBible\Factory as GetBibleFactory; use TrueChristianBible\Joomla\Utilities\Component\Helper; use TrueChristianBible\Joomla\Utilities\GuidHelper; use TrueChristianBible\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; use TrueChristianBible\Joomla\Utilities\JsonHelper; -use TrueChristianBible\Joomla\GetBible\Factory as GetBibleFactory; /** * Getbible List Model for Tag @@ -163,6 +163,13 @@ class GetbibleModelTag extends ListModel $this->input ??= Factory::getApplication()->input; + // we add a Share_His_Word option to set the session key + if (($linker = $this->input->getString('Share_His_Word', null)) !== null + && GetBibleFactory::_('GetBible.Linker')->valid($linker)) + { + GetBibleFactory::_('GetBible.Linker')->trigger($linker); + } + $this->translation = $this->input->getString('t') ?? $this->input->getString('translation', Helper::getParams('com_getbible')->get('default_translation', 'kjv')) ; $this->tag = $this->input->getString('guid') ?? ''; diff --git a/update_server.xml b/update_server.xml index 52077a0..1031926 100644 --- a/update_server.xml +++ b/update_server.xml @@ -764,7 +764,7 @@ 3.1.3-alpha https://getbible.net - https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.3-alpha1.zip + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.3-alpha2.zip stable @@ -779,10 +779,10 @@ pkg_getbible package site - 3.1.3-alpha1 + 3.1.3-alpha2 https://getbible.net - https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.3-alpha1.zip + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.3-alpha2.zip alpha