Checks if one of the current blocks' parents is a shared block.

@return bool
346085
public function hasSharedParent()
    {
        $parent = $this->getParent();

        if ($parent != null && ($parent->isShared() || $parent->hasSharedParent())) {
            return true;
        }

        return false;
    }
430612
public function isTethered(): bool
    {
        $parent = $this->getParent();
        if ($parent === null) {
            return false;
        }
        if (array_key_exists($this->getName(), $parent->getNodeType()->getAutoCreatedChildNodes())) {
            return true;
        }

        return false;
    }
1339654
public function sortBlocks(array $blocks)
    {
        // Determine hierarchy of ownership first
        $hierarchy = array();
        foreach ($blocks as $block) {
            if ($block instanceof BlockOwnerInterface) {
                $key = ($block->getParent()) ? array_search($block->getParent()->getId(), $hierarchy) : false;
                $pos = ($key) ? $key-1 : count($hierarchy)+1;
                $hierarchy[$pos] = $block->getId();
            }
        }
        $hierarchy = array_flip($hierarchy); // Flip it for easier lookup by parentId as key.

        usort($blocks, function ($a, $b) use ($hierarchy) {
            if ($a->getOwner() === null || $b->getOwner() === null) {
                return 0;
            }

            // when blocks sort positions are equal and they have different
            // owners apply inherited sorting
            if ($a->getSort() === $b->getSort() && $a->getOwner()->getId() != $b->getOwner()->getId()) {
                return ($hierarchy[$a->getOwner()->getId()] < $hierarchy[$b->getOwner()->getId()]) ? 1 : -1;
            }

            return ($a->getSort() < $b->getSort()) ? -1 : 1;
        });

        return $blocks;
    }
1129306
public static function isEnabled() {
		$enable_cloning = get_site_option( 'pressbooks_sharingandprivacy_options', [] );
		$enable_cloning = isset( $enable_cloning['enable_cloning'] ) ? $enable_cloning['enable_cloning'] : SharingAndPrivacyOptions::getDefaults()['enable_cloning'];
		return (bool) $enable_cloning;
	}
1229493
public function is_locked() {
        if ($this->_locked) {
            return true;
        }

        if ($parent = $this->get_parent_context()) {
            return $parent->is_locked();
        }

        return false;
    }
556713
public function hasOwned()
    {
        if (!$this->owner->isInDB()) {
            return false;
        }

        $ownedRelationships = $this->owner->config()->get('owns') ?: [];
        foreach ($ownedRelationships as $relationship) {
            /* @var DataObject|SS_List $result */
            $result = $this->owner->{$relationship}();
            if ($result->exists()) {
                return true;
            }
        }

        return false;
    }
90802
protected function isSigchildEnabled()
    {
        if (null !== self::$sigchild) {
            return self::$sigchild;
        }

        if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
            return self::$sigchild = false;
        }

        ob_start();
        phpinfo(INFO_GENERAL);

        return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
    }
128312
public function isEmbeddedOneChangedInParent()
    {
        if (!$rap = $this->getRootAndPath()) {
            return false;
        }

        if ($rap['root'] instanceof EmbeddedGroup) {
            return false;
        }

        $exPath = explode('.', $rap['path']);
        unset($exPath[count($exPath) -1 ]);

        $parentDocument = $rap['root'];
        foreach ($exPath as $embedded) {
            $parentDocument = $parentDocument->{'get'.ucfirst($embedded)}();
            if ($parentDocument instanceof EmbeddedGroup) {
                return false;
            }
        }

        $rap = $this->getRootAndPath();
        $exPath = explode('.', $rap['path']);
        $name = $exPath[count($exPath) - 1];

        return $parentDocument->isEmbeddedOneChanged($name);
    }
507974
public function has_siblings() {
        if (empty($this->parent) || empty($this->parent->children)) {
            return false;
        }
        if ($this->parent->children instanceof navigation_node_collection) {
            $count = $this->parent->children->count();
        } else {
            $count = count($this->parent->children);
        }
        return ($count > 1);
    }
219811
protected function hasData(array $parents)
    {
        $countryCode = $parents[0];
        $addressFormat = $this->addressFormatRepository->get($countryCode);
        $depth = $addressFormat->getSubdivisionDepth();
        if ($depth == 0) {
            return false;
        }
        // At least the first level has data.
        $hasData = true;
        if (count($parents) > 1) {
            // After the first level it is possible for predefined subdivisions
            // to exist at a given level, but not for that specific parent.
            // That's why the parent definition has the most precise answer.
            $grandparents = $parents;
            $parentId = array_pop($grandparents);
            $parentGroup = $this->buildGroup($grandparents);
            if (isset($this->definitions[$parentGroup]['subdivisions'][$parentId])) {
                $definition = $this->definitions[$parentGroup]['subdivisions'][$parentId];
                $hasData = !empty($definition['has_children']);
            } else {
                // The parent definition wasn't loaded previously, fallback
                // to guessing based on depth.
                $neededDepth = count($parents);
                $hasData = ($neededDepth <= $depth);
            }
        }
        return $hasData;
    }
499862
public function showBlocksFields()
	{
		$whiteList = $this->blockManager->getWhiteListedPageTypes();
		$blackList = $this->blockManager->getBlackListedPageTypes();

		if (in_array($this->owner->ClassName, $blackList)) {
			return false;
		}

		if (count($whiteList) && !in_array($this->owner->ClassName, $whiteList)) {
			return false;
		}

		if (!Permission::check('BLOCK_EDIT')) {
			return false;
		}

		return true;
	}
1223237
public static function isLockPrivilegeGranted()
    {
        if (is_null(self::$lockPrivilegeGranted)) {
            try {
                Db::lockTables(Common::prefixTable('log_visit'));
                Db::unlockAllTables();

                self::$lockPrivilegeGranted = true;
            } catch (Exception $ex) {
                self::$lockPrivilegeGranted = false;
            }
        }

        return self::$lockPrivilegeGranted;
    }
423089
public function isVoided()
    {
        if ($this->parent) {
            return $this->parent->isVoided();
        }

        return $this->children->exists(function($key, Transaction $child) {
            return $child->getType() == Transaction\TransactionType::VOID && $child->getStatus() == Result\ResultStatus::APPROVED;
        });
    }
129388
public function containsBlock($block): bool
    {
        if (!$block instanceof IPBlock) {
            $block = new static($block);
        }

        return $block->getFirstIp()->numeric() >= $this->first_ip->numeric() && $block->getLastIp()->numeric() <= $this->last_ip->numeric();
    }
776697
public function is_block_present($blockname) {
        if (empty($this->blockinstances)) {
            return false;
        }

        $requiredbythemeblocks = $this->get_required_by_theme_block_types();
        foreach ($this->blockinstances as $region) {
            foreach ($region as $instance) {
                if (empty($instance->instance->blockname)) {
                    continue;
                }
                if ($instance->instance->blockname == $blockname) {
                    if ($instance->instance->requiredbytheme) {
                        if (!in_array($blockname, $requiredbythemeblocks)) {
                            continue;
                        }
                    }
                    return true;
                }
            }
        }
        return false;
    }
667313
protected function magic_get_blockmanipulations() {
        if (!right_to_left()) {
            return false;
        }
        if (is_null($this->_theme)) {
            $this->initialise_theme_and_output();
        }
        return $this->_theme->blockrtlmanipulations;
    }
1082547
public function isBlocked()
    {
        $ip = $this->getIp();
        $this->deleteAttempts($ip, false);

        // INET_ATON
        $query = "SELECT count(*) FROM {$this->config->table_attempts} WHERE ip = :ip";
        $query_prepared = $this->dbh->prepare($query); // INET_ATON(:ip)
        $query_prepared->execute(['ip' => $ip]);
        $attempts = $query_prepared->fetchColumn();

        if ($attempts < intval($this->config->attempts_before_verify)) {
            return "allow";
        }

        if ($attempts < intval($this->config->attempts_before_ban)) {
            return "verify";
        }

        return "block";
    }