(string) $content, ); } } /** * Draw Inline Block */ public static function _inlineBlock($attributes) { if (isset($attributes['name']) && isset(Block::$inline_blocks[$attributes['name']])) { $content = Filter::apply('content', Text::toHtml(Block::$inline_blocks[$attributes['name']]['content'])); return $content; } else { return ''; } } /** * Get block * * @param string $name Block file name */ public static function get($name) { return Block::_content(array('get' => $name)); } /** * Returns block content for shortcode {block get="blockname"} * * @param array $attributes block filename */ public static function _content($attributes) { if (isset($attributes['get'])) $name = (string) $attributes['get']; else $name = ''; $block_path = STORAGE . DS . 'blocks' . DS . $name . '.block.html'; if (File::exists($block_path)) { ob_start(); include $block_path; $block_contents = ob_get_contents(); ob_end_clean(); return Filter::apply('content', Text::toHtml($block_contents)); } else { if (Session::exists('admin') && Session::get('admin') == true) { return __('Block :name is not found!', 'blocks', array(':name' => $name)); } } } }