Skip to content

Commit

Permalink
updated plugin hero
Browse files Browse the repository at this point in the history
  • Loading branch information
0xBeycan committed Feb 2, 2024
1 parent fbb699a commit 6081bdd
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 40 deletions.
4 changes: 2 additions & 2 deletions app/PluginHero/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
class Entity
{
/**
* @var object
* @var object|null
*/
public object $entity;
public ?object $entity;

/**
* @param int|null $entityId
Expand Down
10 changes: 10 additions & 0 deletions app/PluginHero/Helpers/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ public static function toFixed(float|int $number, int $decimals): float
return floatval(number_format($number, $decimals, '.', ""));
}

/**
* @param float|int $number
* @param int $decimals
* @return string
*/
public static function numberFormat(float|int $number, int $decimals = 2): string
{
return preg_replace('/(\.0*|0+)$/', '', number_format($number, $decimals, '.', ','));
}

/**
* @param float|int $amount
* @param integer $decimals
Expand Down
2 changes: 1 addition & 1 deletion app/PluginHero/Helpers/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public static function parseAllowedHtml(string $html): array

$result = [
'style' => true,
'script' => true,
'script' => true
];

foreach ($dom->getElementsByTagName('*') as $element) {
Expand Down
2 changes: 1 addition & 1 deletion app/PluginHero/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class Response
private static function json(array $data, int $statusCode): void
{
http_response_code($statusCode);
die(wp_json_encode($data));
die(json_encode($data));
}

/**
Expand Down
6 changes: 5 additions & 1 deletion app/PluginHero/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ public function renderDataTable(string $id, array $options = []): string
wp_enqueue_script('bwptable-vfs-font', 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js', [], null, true);
wp_enqueue_script('bwptable-data-table', 'https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.12.1/b-2.2.3/b-colvis-2.2.3/b-html5-2.2.3/b-print-2.2.3/date-1.1.2/r-2.3.0/sb-1.3.4/datatables.min.js', ['jquery'], null, true);
// @phpcs:enable
return include dirname(__DIR__) . '/views/data-table.php';

return self::getTemplate('data-table', [
'id' => $id,
'options' => $options
]);
}
}
15 changes: 0 additions & 15 deletions app/PluginHero/composer.json

This file was deleted.

20 changes: 0 additions & 20 deletions app/PluginHero/composer.lock

This file was deleted.

0 comments on commit 6081bdd

Please sign in to comment.