PHP Classes

File: docs/changelogs/changelog-11526.en.md

Recommend this page to a friend!
  Classes of ASCOOS CMS   Ascoos Framework   docs/changelogs/changelog-11526.en.md   Download  
File: docs/changelogs/changelog-11526.en.md
Role: Documentation
Content type: text/markdown
Description: Ascoos Framework 25.0.0.11526 Changelog file
Class: Ascoos Framework
Framework of general purposes classes
Author: By
Last change:
Date: 5 days ago
Size: 5,862 bytes
 

 

Contents

Class file image Download

Changelog

25.0.0 [11526]

? 2025-03-31

Note

> The source code intended for commercial use cannot be provided as it is encrypted. > Ascoos Cms users will have access to all class functionalities, but the source code will remain hidden.

Default Global Variables

Objects - $html : [Only Commercial Edition]

> A utility class that provides methods for handling HTML.

```php
// Syntax
THTML::__construct(array $array = [], array $properties = [], ?TLoggerHandler $logger = null);

// USE
$html =& THTML::getInstance();
echo $html->br(2);

/*
 * Concatenates the label with an optional separator and a number of non-breaking spaces generated by the spaces() method.
 * @param string $label         The base label text.
 * @param int    $num           The number of non-breaking spaces to generate and append.
 * @param string $sep           An optional separator inserted between the label and the spaces. Defaults to an empty string.
 * @param bool   $before_space  Whether to add an extra space before the generated spaces.
 * @param bool   $after_space   Whether to add an extra space after the generated spaces.
 */    
echo $html->spacedLabel('Test Label', 5, ':', true, false);

echo $html->hr(3, 3);

$html->Free($html);

// Output: <br><br>Test Label: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br><br><hr><br><br><br>
```

  • `$objString` : [Only Commercial Edition]

    > This class provides helper functions for managing and manipulating string data consistently and in a reusable way.

    $objString =& TString::getInstance();
    
    $str = '  Greek:????????? ?????????????, "1\/ ????????  ';
    
    echo $html->spacedLabel('TString->escape', 4, ':', true);
    echo $objString->escape($str);
    echo $html->hr(2);
    echo $html->spacedLabel('TString->quote', 4, ':', true);
    echo $objString->quote($str, '\'');
    
  • `$utf8` : [Only Commercial Edition]

    > A utility class providing methods for handling UTF-8 strings, detecting and validating encoding.

    /
     * Repeat a string
     * @param string $string        The string to be repeated.
     * @param int $times            Number of times the string should be repeated.
     *                              Times has to be greater than or equal to 0. If set to 0, 
     *                              the function will return an empty string.
     * @param ?string $encoding     The character encoding to use. Defaults to 'UTF-8' if omitted or null.
     */ 
    echo $utf8->str_repeat('Greek:????????? ?????????????, ????????', 2)
    // output: Greek:????????? ?????????????, ????????Greek:????????? ?????????????, ????????
    

Arrays - $conf : Ascoos Framework Configuration Data

Paths - $AFW_PATH or $afw_path : Ascoos Framework Path - $AFW_KERNEL_PATH or $afw_kernel_path : Ascoos Framework Kernel Path - $AFW_KERNEL_IMPLEMENTATION_PATH : Ascoos Framework Kernel Implementation Path - $AFW_KERNEL_HANDLERS_PATH : Ascoos Framework Kernel Handlers Path - $AFW_EXTRAS_PATH : Ascoos Framework Extras Classes Path - $AFW_CONFIG_PATH : Ascoos Framework Configuration Path - $AFW_LIBS_PATH : Ascoos Framework Libraries Path - $AFW_LOGS_PATH : Ascoos Framework Logs Path - $AFW_CACHE_PATH : Ascoos Framework Cache Path

Global Functions

  • `formatBytes` : The `$bytes` argument can now accept float values. The result generation process has also been improved.

    // Global function
    formatBytes(float|int $bytes, int $precision = 2): string
    

Classes

  • `TArrayHandler` : - `__construct` : In the commercial edition, an argument supporting report handling has been added.

    ```php public function __construct(array $array = [], array $properties = [], ?TLoggerHandler $logger = null) ```

    - `getInstance` : An instance method has been added to the class. In the commercial edition, an argument supporting report handling has been added.

    ```php public static function &getInstance(array $array, array $properties = [], ?TLoggerHandler $logger = null) ```

    - `fromJSON` : 1. Added the `depth` argument for dynamic selection of the maximum nesting depth for JSON decoding. Default: 512.

    ```php public function fromJSON(string $json, ?string $key = null, int $depth = 512): bool ``` 2. The character encoding of retrieved JSON file content is now UTF8.

    - `fromJSONFile` : 1. Added the `depth` argument for dynamic selection of the maximum nesting depth for JSON decoding. Default: 512.

    ```php public function fromJSONFile(string $filePath, ?string $key = null, int $depth = 512): bool ```

    - `toJSON` : 1. Fixed storage error in JSON files when saving UTF8 characters. 2. Added the `$array` argument for supporting an external array. If not provided, it returns the internal array `$this->array`.

    ```php public function toJSON(?array $array = null): string ``` 3. Added new functionality.

    - `toJSONFile` : 1. Added the `$array` argument for external array selection. If not provided, it returns the internal array `$this->array`.

    ```php public function toJSONFile(string $filePath, ?array $array = null) ```