]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added optional 4th argument 'class' for elgg_instanceof().
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 23 Jun 2010 17:07:21 +0000 (17:07 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 23 Jun 2010 17:07:21 +0000 (17:07 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6556 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/entities.php

index 3b383094884db3a9e8f4b952d95cbdc58ffb952a..0f718d16243370c7486362c46f2b5a28946da542 100644 (file)
@@ -3681,8 +3681,9 @@ function recursive_delete_permissions_check($hook, $entity_type, $returnvalue, $
  * @param $type
  * @param $subtype
  * @return Bool
+ * @since 1.8
  */
-function elgg_instanceof($entity, $type = NULL, $subtype = NULL) {
+function elgg_instanceof($entity, $type = NULL, $subtype = NULL, $class = NULL) {
        $return = ($entity instanceof ElggEntity);
 
        if ($type) {
@@ -3692,6 +3693,10 @@ function elgg_instanceof($entity, $type = NULL, $subtype = NULL) {
        if ($subtype) {
                $return = $return && ($entity->getSubtype() == $subtype);
        }
+       
+       if ($class) {
+               $return = $return && ($entity instanceof $class);
+       }
 
        return $return;
 }