Rev 1086 | Rev 1131 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1086 | Rev 1116 | ||
---|---|---|---|
Line 23... | Line 23... | ||
23 | \defined('INSIDE_OIDPLUS') or die; |
23 | \defined('INSIDE_OIDPLUS') or die; |
24 | // phpcs:enable PSR1.Files.SideEffects |
24 | // phpcs:enable PSR1.Files.SideEffects |
25 | 25 | ||
26 | class OIDplusObjectTypePluginOid extends OIDplusObjectTypePlugin { |
26 | class OIDplusObjectTypePluginOid extends OIDplusObjectTypePlugin { |
27 | 27 | ||
- | 28 | /** |
|
- | 29 | * @return string |
|
- | 30 | */ |
|
28 | public static function getObjectTypeClassName() { |
31 | public static function getObjectTypeClassName(): string { |
29 | return OIDplusOid::class; |
32 | return OIDplusOid::class; |
30 | } |
33 | } |
31 | 34 | ||
- | 35 | /** |
|
- | 36 | * @param string $id |
|
- | 37 | * @return bool |
|
- | 38 | */ |
|
32 | public function implementsFeature($id) { |
39 | public function implementsFeature(string $id): bool { |
33 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.6') return true; // gridGeneratorLinks |
40 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.6') return true; // gridGeneratorLinks |
34 | return false; |
41 | return false; |
35 | } |
42 | } |
36 | 43 | ||
- | 44 | /** |
|
37 | public function gridGeneratorLinks($objParent) { // Interface 1.3.6.1.4.1.37476.2.5.2.3.6 |
45 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.6 |
- | 46 | * @param OIDplusObject $objParent |
|
- | 47 | * @return string |
|
38 | 48 | */ |
|
- | 49 | public function gridGeneratorLinks(OIDplusObject $objParent): string { |
|
39 | if ($objParent->nodeId() === 'oid:2.25') { |
50 | if ($objParent->nodeId() === 'oid:2.25') { |
40 | return '<br><a href="javascript:OIDplusObjectTypePluginOid.generateRandomUUID(false)">('._L('Generate a random UUID OID').')</a>'; |
51 | return '<br><a href="javascript:OIDplusObjectTypePluginOid.generateRandomUUID(false)">('._L('Generate a random UUID OID').')</a>'; |
41 | } else if ($objParent->isRoot()) { |
52 | } else if ($objParent->isRoot()) { |
42 | return '<br><a href="javascript:OIDplusObjectTypePluginOid.generateRandomUUID(true)">('._L('Generate a random UUID OID').')</a>'. |
53 | return '<br><a href="javascript:OIDplusObjectTypePluginOid.generateRandomUUID(true)">('._L('Generate a random UUID OID').')</a>'. |
43 | '<br><a href="https://oidplus.viathinksoft.com/oidplus/?goto=oidplus%3Acom.viathinksoft.freeoid" target="_blank">('._L('Request a free OID from ViaThinkSoft').')</a>'. |
54 | '<br><a href="https://oidplus.viathinksoft.com/oidplus/?goto=oidplus%3Acom.viathinksoft.freeoid" target="_blank">('._L('Request a free OID from ViaThinkSoft').')</a>'. |
44 | '<br><a href="https://pen.iana.org/pen/PenApplication.page" target="_blank">('._L('Request a free PEN/OID from IANA').')</a>'; |
55 | '<br><a href="https://pen.iana.org/pen/PenApplication.page" target="_blank">('._L('Request a free PEN/OID from IANA').')</a>'; |
45 | } else { |
56 | } else { |
46 | // No generation for normal OIDs atm. TODO: MAYBE in future a feature "next free" |
57 | // No generation for normal OIDs atm. TODO: MAYBE in the future a feature like "next free / sequencial OID" |
47 | return ''; |
58 | return ''; |
48 | } |
59 | } |
49 | } |
60 | } |
50 | 61 | ||
- | 62 | /** |
|
- | 63 | * @param string $static_node_id |
|
- | 64 | * @param bool $throw_exception |
|
- | 65 | * @return string |
|
- | 66 | * @throws OIDplusException |
|
- | 67 | */ |
|
51 | public static function prefilterQuery($static_node_id, $throw_exception) { |
68 | public static function prefilterQuery(string $static_node_id, bool $throw_exception): string { |
52 | // Convert WEID to OID |
69 | // Convert WEID to OID |
53 | // A WEID is just a different notation of an OID. |
70 | // A WEID is just a different notation of an OID. |
54 | // To allow that people use OID-IP or the GoTo-box with a "weid:" identifier, rewrite it to "oid:", so that the plugin OIDplusObjectTypePluginOid can handle it. |
71 | // To allow that people use OID-IP or the GoTo-box with a "weid:" identifier, rewrite it to "oid:", so that the plugin OIDplusObjectTypePluginOid can handle it. |
55 | if (str_starts_with($static_node_id,'weid:') && class_exists('\Frdl\Weid\WeidOidConverter')) { |
72 | if (str_starts_with($static_node_id,'weid:') && class_exists('\Frdl\Weid\WeidOidConverter')) { |
56 | $ary = explode('$', $static_node_id, 2); |
73 | $ary = explode('$', $static_node_id, 2); |