Given a block name, find out of any of them are currently present in the page

@param string $blockname - the basic name of a block (eg "navigation")
@return boolean - is there one of these blocks in the current page?
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;
    }
159919
protected function check_known_block_type($blockname, $includeinvisible = false) {
        if (!$this->is_known_block_type($blockname, $includeinvisible)) {
            if ($this->is_known_block_type($blockname, true)) {
                throw new coding_exception('Unknown block type ' . $blockname);
            } else {
                throw new coding_exception('Block type ' . $blockname . ' has been disabled by the administrator.');
            }
        }
    }
71489
protected function isBlockEnd($line, $blockName = null)
    {
        $line = trim($line);
        $pattern = '/^\<\/';
        $pattern .= ($blockName) ? $blockName : '[^\s\>]+';
        $pattern .= '\>$/';
        return (preg_match($pattern, $line) > 0);
    }
23280
protected function _filterBlock(Block $block)
    {
        $cacheKey = "allowed_{$block->id}";
        $cache = static::cache($cacheKey);

        if ($cache !== null) {
            return $cache;
        }

        if (!empty($block->locale) &&
            !in_array(I18n::locale(), (array)$block->locale)
        ) {
            return static::cache($cacheKey, false);
        }

        if (!$block->isAccessibleByUser()) {
            return static::cache($cacheKey, false);
        }

        $allowed = false;
        switch ($block->visibility) {
            case 'except':
                // Show on all pages except listed pages
                $allowed = !$this->_urlMatch($block->pages);
                break;
            case 'only':
                // Show only on listed pages
                $allowed = $this->_urlMatch($block->pages);
                break;
            case 'php':
                // Use custom PHP code to determine visibility
                $allowed = php_eval($block->pages, [
                    'view' => &$this->_View,
                    'block' => &$block
                ]) === true;
                break;
        }

        if (!$allowed) {
            return static::cache($cacheKey, false);
        }

        return static::cache($cacheKey, true);
    }
160910
function assign( $blockName, $varName, &$variable )
    {
        if ( isset( $this->BlockValues[$blockName][$varName] ) )
            $variable = $this->BlockValues[$blockName][$varName];
        else
            return false;
        return true;
    }
155731
public function getBlockPath($filename = null)
    {
        $obj = $this->blockType;
        if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . $filename)) {
            $base = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle();
        } else {
            if ($obj->getPackageID() > 0) {
                if (is_dir(DIR_PACKAGES . '/' . $obj->getPackageHandle())) {
                    $base = DIR_PACKAGES . '/' . $obj->getPackageHandle(
                        ) . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
                } else {
                    $base = DIR_PACKAGES_CORE . '/' . $obj->getPackageHandle(
                        ) . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
                }
            } else {
                $base = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle();
            }
        }

        return $base;
    }
1015850
protected function findTemplateWithBlock($blockName, $localTemplate = null)
    {
        if ($localTemplate !== null) {
            if (is_string($localTemplate)) {
                $localTemplate = $this->twig->load($localTemplate);
            }

            if ($localTemplate->hasBlock($blockName)) {
                return $localTemplate;
            }
        }

        foreach ($this->limitationValueResources as &$template) {
            if (is_string($template)) {
                // Load the template if it is necessary
                $template = $this->twig->load($template);
            }

            if ($template->hasBlock($blockName)) {
                return $template;
            }
        }

        return null;
    }
1031454
public function hasBlock( $section )
	{
		$names	= array_keys( $this->blocks );
		$result	= array_search( $section, $names );
		$return	= is_int( $result );
		return $return;
	}
391274
public function getSampleBlock($blockNum)
    {
        // check preconditions
        if (!$this->_dataSize_valid) {
            $this->setDataSize();  // implicit setSize(), setActualSize(), setNumBlocks()
        }

        $offset = $blockNum * $this->_blockAlign;
        if ($offset + $this->_blockAlign > $this->_dataSize || $offset < 0) {
            return null;
        }


        // read data
        return substr($this->_samples, $offset, $this->_blockAlign);
    }
245929
public static boolean isInlineChecksumBlockFilename(String fileName) {
    if (!isBlockFileName(fileName)) {
      return false;
    }
    int index_sep = fileName.indexOf('_', Block.BLOCK_FILE_PREFIX.length());
    return index_sep > 0 && fileName.indexOf('.', index_sep) < 0;
  }
797306
public function getBlock($key)
    {
        if (($find = $this->searchBlock($key)) !== null) {
            return $find;
        }

        throw new \Exception(htmlspecialchars("The block $key does not exist."));
    }
979977
public function seeCurrentRouteIs($routeName)
    {
        $this->getRouteByName($routeName); // Fails if route does not exists

        $currentRoute = $this->app->request->route();
        $currentRouteName = $currentRoute ? $currentRoute->getName() : '';

        if ($currentRouteName != $routeName) {
            $message = empty($currentRouteName)
                ? "Current route has no name"
                : "Current route is \"$currentRouteName\"";
            $this->fail($message);
        }
    }
1324860
public function block($name, $default = null)
    {
        return isset($this->blocks[$name]) ? $this->blocks[$name] : $default;
    }
144782
function hasVariable( $blockName, $varName )
    {
        // 1. Check if the variable is set in either injected or regular settings.
        if (
            !isset( self::$injectedSettings[$this->FileName][$blockName][$varName] )
            && !isset( $this->BlockValues[$blockName][$varName] )
        )
        {
            return false;
        }

        // 2. Check if injected setting isn't strictly false (false being the default value when a variable doesn't exist).
        if (
            isset( self::$injectedSettings[$this->FileName][$blockName][$varName] )
            && self::$injectedSettings[$this->FileName][$blockName][$varName] === false
        )
        {
            return false;
        }

        return true;
    }
595671
protected function _getChildBlockNames($blockNode) {
        Varien_Profiler::start('turpentine::helper::data::_getChildBlockNames');
        if ($blockNode instanceof Mage_Core_Model_Layout_Element) {
            $blockNames = array((string) $blockNode['name']);
            foreach ($blockNode->xpath('./block | ./reference') as $childBlockNode) {
                $blockNames = array_merge($blockNames,
                    $this->_getChildBlockNames($childBlockNode));
                if ($this->getLayout() instanceof Varien_Simplexml_Config) {
                    foreach ($this->getLayout()->getNode()->xpath(sprintf(
                        '//reference[@name=\'%s\']', (string) $childBlockNode['name'] ))
                            as $childBlockLayoutNode) {
                        $blockNames = array_merge($blockNames,
                            $this->_getChildBlockNames($childBlockLayoutNode));

                    }
                }
            }
        } else {
            $blockNames = array();
        }
        Varien_Profiler::stop('turpentine::helper::data::_getChildBlockNames');
        return $blockNames;
    }
1076365
public function hasMethod($methodName)
    {
        return \method_exists($this, $methodName) || \method_exists($this, $this->public_function_prefix . $methodName);
    }
893996
public function exists($name)
    {
        $viewblocks = $this->get('viewblocks', []);

        return !empty($viewblocks[$name]) || $this->Blocks->exists($name);
    }