mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-01-23 16:57:59 -05:00
- Replaced == with === to avoid type juggling - Removed unneeded TODO - Added HTMLPurifier to composer.json - Added Service to allow singleton instance of purifier. - Implemented use in Customer Controller Search function. Signed-off-by: objecttothis <objecttothis@gmail.com>
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Config;
|
|
|
|
use CodeIgniter\Config\BaseService;
|
|
use HTMLPurifier;
|
|
use HTMLPurifier_Config;
|
|
|
|
/**
|
|
* Services Configuration file.
|
|
*
|
|
* Services are simply other classes/libraries that the system uses
|
|
* to do its job. This is used by CodeIgniter to allow the core of the
|
|
* framework to be swapped out easily without affecting the usage within
|
|
* the rest of your application.
|
|
*
|
|
* This file holds any application-specific services, or service overrides
|
|
* that you might need. An example has been included with the general
|
|
* method format you should use for your service methods. For more examples,
|
|
* see the core Services file at system/Config/Services.php.
|
|
*/
|
|
class Services extends BaseService
|
|
{
|
|
/*
|
|
* public static function example($getShared = true)
|
|
* {
|
|
* if ($getShared) {
|
|
* return static::getSharedInstance('example');
|
|
* }
|
|
*
|
|
* return new \CodeIgniter\Example();
|
|
* }
|
|
*/
|
|
|
|
private static $htmlPurifier;
|
|
|
|
public static function htmlPurifier($getShared = true)
|
|
{
|
|
if ($getShared)
|
|
{
|
|
return static::getSharedInstance('htmlPurifier');
|
|
}
|
|
|
|
if (!isset(static::$htmlPurifier))
|
|
{
|
|
$config = HTMLPurifier_Config::createDefault();
|
|
static::$htmlPurifier = new HTMLPurifier($config);
|
|
}
|
|
|
|
return static::$htmlPurifier;
|
|
}
|
|
}
|