Subversion Repositories oidplus

Rev

Rev 962 | Rev 1086 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 962 Rev 1050
Line 15... Line 15...
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
17
 * limitations under the License.
18
 */
18
 */
19
 
19
 
20
if (!defined('INSIDE_OIDPLUS')) die();
20
namespace ViaThinkSoft\OIDplus;
21
 
21
 
22
class OIDplusObjectTypePluginOid extends OIDplusObjectTypePlugin {
22
class OIDplusObjectTypePluginOid extends OIDplusObjectTypePlugin {
23
 
23
 
24
        public static function getObjectTypeClassName() {
24
        public static function getObjectTypeClassName() {
25
                return OIDplusOid::class;
25
                return OIDplusOid::class;
Line 46... Line 46...
46
 
46
 
47
        public static function prefilterQuery($static_node_id, $throw_exception) {
47
        public static function prefilterQuery($static_node_id, $throw_exception) {
48
                // Convert WEID to OID
48
                // Convert WEID to OID
49
                // A WEID is just a different notation of an OID.
49
                // A WEID is just a different notation of an OID.
50
                // 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.
50
                // 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.
51
                if (str_starts_with($static_node_id,'weid:') && class_exists('WeidOidConverter')) {
51
                if (str_starts_with($static_node_id,'weid:') && class_exists('\Frdl\Weid\WeidOidConverter')) {
52
                        $ary = explode('$', $static_node_id, 2);
52
                        $ary = explode('$', $static_node_id, 2);
53
                        $weid = $ary[0];
53
                        $weid = $ary[0];
54
                        $oid = WeidOidConverter::weid2oid($weid);
54
                        $oid = \Frdl\Weid\WeidOidConverter::weid2oid($weid);
55
                        if ($oid === false) {
55
                        if ($oid === false) {
56
                                if ($throw_exception) throw new OIDplusException('This is not a valid WEID');
56
                                if ($throw_exception) throw new OIDplusException('This is not a valid WEID');
57
                        } else {
57
                        } else {
58
                                $ary[0] = $oid;
58
                                $ary[0] = $oid;
59
                                $static_node_id = 'oid:'.implode('$', $ary);
59
                                $static_node_id = 'oid:'.implode('$', $ary);