__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php /** * @package Regular Labs Library * @version 23.12.10783 * * @author Peter van Westen <[email protected]> * @link https://regularlabs.com * @copyright Copyright © 2023 Regular Labs All Rights Reserved * @license GNU General Public License version 2 or later */ namespace RegularLabs\Library; defined('_JEXEC') or die; class HtmlTag { /** * Combine 2 opening html tags into one */ public static function combine(string $tag1, string $tag2): string { // Return if tags are the same if ($tag1 == $tag2) { return $tag1; } if ( ! RegEx::match('<([a-z][a-z0-9]*)', $tag1, $tag_type)) { return $tag2; } $tag_type = $tag_type[1]; $attribs = self::combineAttributes($tag1, $tag2); if ( ! $attribs) { return '<' . $tag_type . '>'; } return '<' . $tag_type . ' ' . $attribs . '>'; } /** * Combine attribute values from 2 given html tag strings (or arrays of attributes) * And return as a string of attributes (if $flatten = true) */ public static function combineAttributes( string|array $string1, string|array $string2, bool $flatten = true ): string|array { $attribsutes1 = is_array($string1) ? $string1 : self::getAttributes($string1); $attribsutes2 = is_array($string2) ? $string2 : self::getAttributes($string2); $duplicate_attributes = array_intersect_key($attribsutes1, $attribsutes2); // Fill $attributes with the unique ids $attributes = array_diff_key($attribsutes1, $attribsutes2) + array_diff_key($attribsutes2, $attribsutes1); // List of attrubute types that can only contain one value $single_value_attributes = ['id', 'href']; // Add/combine the duplicate ids foreach ($duplicate_attributes as $key => $val) { if (in_array($key, $single_value_attributes, true)) { $attributes[$key] = $attribsutes2[$key]; continue; } // Combine strings, but remove duplicates // "aaa bbb" + "aaa ccc" = "aaa bbb ccc" // use a ';' as a concatenated for javascript values (keys beginning with 'on') // Otherwise use a space (like for classes) $glue = str_starts_with($key, 'on') ? ';' : ' '; $attributes[$key] = implode($glue, [...explode($glue, $attribsutes1[$key]), ...explode($glue, $attribsutes2[$key])]); } return $flatten ? self::flattenAttributes($attributes) : $attributes; } /** * Convert array or object of attributes to a html style string */ public static function flattenAttributes(array|object $attributes, string $prefix = ''): string { $output = []; foreach ($attributes as $key => $val) { if (is_null($val) || $val === '') { continue; } if ($val === false) { $val = 'false'; } if ($val === true) { $val = 'true'; } $val = str_replace('"', '"', $val); $output[] = $prefix . $key . '="' . $val . '"'; } return implode(' ', $output); } /** * Extract attribute value from a html tag string by given attribute key */ public static function getAttributeValue(string $key, string $string): string { if (empty($key) || empty($string)) { return ''; } RegEx::match(RegEx::quote($key) . '="([^"]*)"', $string, $match); if (empty($match)) { return ''; } return $match[1]; } /** * Extract all attributes from a html tag string */ public static function getAttributes(string $string): array { if (empty($string)) { return []; } RegEx::matchAll('([a-z0-9-_]+)="([^"]*)"', $string, $matches); if (empty($matches)) { return []; } $attribs = []; foreach ($matches as $match) { $attribs[$match[1]] = $match[2]; } return $attribs; } /** * Returns true/false based on whether the html tag type is a single tag */ public static function isSelfClosingTag(string $type): bool { return in_array($type, [ 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr', ], true); } }
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Form | Folder | 0775 |
|
|
| ActionLogPlugin.php | File | 8.29 KB | 0664 |
|
| Alias.php | File | 3.22 KB | 0664 |
|
| ArrayHelper.php | File | 14.13 KB | 0664 |
|
| Article.php | File | 10.14 KB | 0664 |
|
| Cache.php | File | 4.69 KB | 0664 |
|
| Color.php | File | 1.85 KB | 0664 |
|
| DB.php | File | 15.25 KB | 0664 |
|
| Date.php | File | 5.25 KB | 0664 |
|
| Document.php | File | 13.21 KB | 0664 |
|
| DownloadKey.php | File | 3.92 KB | 0664 |
|
| EditorButtonPlugin.php | File | 5.9 KB | 0664 |
|
| EditorButtonPopup.php | File | 5.53 KB | 0664 |
|
| Extension.php | File | 14.81 KB | 0664 |
|
| FieldsPlugin.php | File | 1001 B | 0664 |
|
| File.php | File | 14.92 KB | 0664 |
|
| Html.php | File | 22.41 KB | 0664 |
|
| HtmlTag.php | File | 4.84 KB | 0664 |
|
| Http.php | File | 4.54 KB | 0664 |
|
| Image.php | File | 29.04 KB | 0664 |
|
| Input.php | File | 4.64 KB | 0664 |
|
| Language.php | File | 985 B | 0664 |
|
| License.php | File | 1.78 KB | 0664 |
|
| MobileDetect.php | File | 748 B | 0664 |
|
| ObjectHelper.php | File | 2.92 KB | 0664 |
|
| Parameters.php | File | 7.27 KB | 0664 |
|
| Php.php | File | 6.81 KB | 0664 |
|
| PluginTag.php | File | 16.31 KB | 0664 |
|
| Protect.php | File | 27.82 KB | 0664 |
|
| RegEx.php | File | 8.02 KB | 0664 |
|
| ShowOn.php | File | 1.44 KB | 0664 |
|
| SimpleCategory.php | File | 1.7 KB | 0664 |
|
| StringHelper.php | File | 22.9 KB | 0664 |
|
| StringReplacer.php | File | 13.66 KB | 0664 |
|
| SystemPlugin.php | File | 15.4 KB | 0664 |
|
| Title.php | File | 2.8 KB | 0664 |
|
| Uri.php | File | 6.06 KB | 0664 |
|
| Variables.php | File | 11.55 KB | 0664 |
|
| Version.php | File | 8.32 KB | 0664 |
|
| Xml.php | File | 1.53 KB | 0664 |
|