Rev 1123 | Rev 1130 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1123 | Rev 1127 | ||
---|---|---|---|
Line 1147... | Line 1147... | ||
1147 | 1147 | ||
1148 | // The auto-loader of OIDplus currently does not accept PHP namespaces. |
1148 | // The auto-loader of OIDplus currently does not accept PHP namespaces. |
1149 | // Reason: The autoloader detects the classes inside plugins/*/*/*/*.class.php, but it cannot know |
1149 | // Reason: The autoloader detects the classes inside plugins/*/*/*/*.class.php, but it cannot know |
1150 | // which namespace these files have, because their folder names do not reveal the namespace. |
1150 | // which namespace these files have, because their folder names do not reveal the namespace. |
1151 | // So it just ignores the namespace and loads all classes with the same name. |
1151 | // So it just ignores the namespace and loads all classes with the same name. |
1152 | // There can be problems if two plugins have the same classname (but are in different namespaces, e.g. |
- | |
1153 | // because they are made by different vendors). For example, two object types with the same PHP class name |
- | |
1154 | // get mixed up getIcon()'s. |
- | |
1155 | // TODO: Think about a solution; There was a discussion here https://github.com/frdl/frdl-oidplus-plugin-type-pen/issues/1 |
1152 | // TODO: Think about a solution; There was a discussion here https://github.com/frdl/frdl-oidplus-plugin-type-pen/issues/1 |
1156 | $tmp = explode('\\',$class_name); |
1153 | $tmp = explode('\\',$class_name); |
1157 | $class_name_no_namespace = end($tmp); |
1154 | $class_name_no_namespace = end($tmp); |
1158 | if (in_array($class_name_no_namespace, $known_main_classes_no_namespace)) { |
1155 | if (in_array($class_name_no_namespace, $known_main_classes_no_namespace)) { |
- | 1156 | // Removed check for now, since everything should work correctly |
|
1159 | throw new OIDplusException(_L('More than one plugin has the PHP class name "%1". This is currently no supported, not even if they are in different namespaces.', $class_name_no_namespace)); |
1157 | // throw new OIDplusException(_L('More than one plugin has the PHP class name "%1". This is currently no supported, not even if they are in different namespaces.', $class_name_no_namespace)); |
1160 | } |
1158 | } |
1161 | $known_main_classes_no_namespace[] = $class_name_no_namespace; |
1159 | $known_main_classes_no_namespace[] = $class_name_no_namespace; |
1162 | 1160 | ||
1163 | // Do some basic checks on the plugin PHP main class |
1161 | // Do some basic checks on the plugin PHP main class |
1164 | if (!class_exists($class_name)) { |
1162 | if (!class_exists($class_name)) { |