From 21829153faf01d265d29b130e7be3fe7f6380c3f Mon Sep 17 00:00:00 2001 From: wojciech Date: Mon, 5 Jan 2026 13:41:30 +0100 Subject: [PATCH] Move documentation to the Readme.md --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4fc7b07..e5fe125 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,72 @@ -# InIT DRY - InIT.biz package with useful classes and helpers. +# InIT DRY - InIT.biz package with useful classes and helpers. + ![SEO Storm - ultimate SEO tool for OctoberCMS](https://raw.githubusercontent.com/initbiz/initdry-plugin/master/docs/init-dry.png) This is a repo of OctoberCMS plugin by [InIT.biz](https://init.biz). -For full documentation visit [https://docs.init.biz/article/init-dry](https://docs.init.biz/article/init-dry) or go to [OctoberCMS's marketplace](https://octobercms.com/plugin/initbiz-initdry). +## Introduction + +A collection of useful classes and helpers that can save you a bundle of development time. + +## `PluginRegistrationManager` + +The `PluginRegistrationManager` was created to run and merge the output of any register methods from `Plugin.php` in your system. Using the manager you can define your own register*something* method which returns an array of merged arrays. + +The manager is `Singleton` so the example usage would be as follows: + +```php + $pluginRegistrationManager = PluginRegistrationManager::instance(); + $registeredDefinitions = $pluginRegistrationManager->runMethod('registerMyPluginDefinitions'); +``` + +## `Helpers` + +Class with commonly used functions that do not belong to any other helpers. + + getUser() : mixed + Get currently logged in user and timestamp 'last seen' + Returns: + mixed — (User || null) + + getFileListToDropdown() : array + Helper to be used in models to list all cms pages in dropdown + Returns: + array — pages base file names + + getPageUrl(string $pageCode, \Cms\Classes\Theme $theme = null) : string + Get url of page using page code + Parameters: + string $pageCode page code + \Cms\Classes\Theme $theme theme object + Returns: + string — url + +## `StringHelpers` + +Class with string helpers. + + random_str(integer $length, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') : string + A method by Scott Arciszewski: https://stackoverflow.com/a/31107425 + Generate a random string, using a cryptographically secure + pseudorandom number generator (random_int) + Parameters: + integer $length How many characters do we want? + string $keyspace A string of all possible characters to select from + Returns: + string + + ucwords(string $string, array $delimiters = array(' ', '-', '\'', '"', ".")) : string + Upper case every word after the delimiter + Parameters: + string $string string to upper case after all delimiters + array $delimiters array of delimiters to uppercase after + Returns: + string — parsed string + + mb_ucfirst(string $string, string $encoding = 'UTF-8') : string + First letter uppercase in string + Parameters: + string $string string to make first letter upper case + string $encoding encoding + Returns: + string — First letter uppercased string