本文整理汇总了PHP中Helpers::getContainer方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::getContainer方法的具体用法?PHP Helpers::getContainer怎么用?PHP Helpers::getContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helpers
的用法示例。
在下文中一共展示了Helpers::getContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Creates a new Typeahead instance.
*
* @param array $source Array of items for list
* @param int $items Number of items to display
* @param array $attributes An array of attributes to use
*
* @return Typeahead
*/
public static function create($source, $items = 8, $attributes = array())
{
$attributes['type'] = 'text';
$attributes['data-items'] = $items;
$attributes['data-provide'] = 'typeahead';
$attributes['data-source'] = json_encode($source);
return '<input' . Helpers::getContainer('html')->attributes($attributes) . '>';
}
示例2: make
private static function make($type, $contents = array(), $attributes = array())
{
$attributes = Helpers::add_class($attributes, 'buttons', 'data-toggle');
$attributes = Helpers::add_class($attributes, 'btn-group');
$string = "<div " . Helpers::getContainer('html')->attributes($attributes) . ">";
$string .= static::makeContents($contents, $type);
$string .= "</div>";
return $string;
}
示例3: show
/**
* Adds a bar to the current progress bar
*
* @param integer $amounts A progress amount
* @param string $type Type of progress bar
* @param array $attributes array of attributes for progress bar
*
* @return string
*/
protected static function show($amounts = 0, $type = Progress::NORMAL, $attributes = array())
{
if (is_array($amounts)) {
$type = Progress::NORMAL;
}
$attributes = Helpers::add_class($attributes, 'progress ' . $type);
// Create the progress bar(s)
$progress = '<div' . Helpers::getContainer('html')->attributes($attributes) . '>';
if (!is_array($amounts)) {
$amounts = array((int) $amounts => null);
}
foreach ($amounts as $amount => $style) {
$progress .= static::bar($amount, $style);
}
$progress .= '</div>';
return $progress;
}
示例4: __toString
public function __toString()
{
$name = $this->name;
$attributes = Helpers::add_class($this->attributes, 'panel-group');
$attributes = Helpers::add_class($attributes, $name, 'id');
$string = "<div" . Helpers::getContainer('html')->attributes($attributes) . ">";
$count = 1;
foreach ($this->contents as $content) {
$heading = $content[0];
$body = $content[1];
$panelAttributes = isset($content[2]) ? $content[2] : array();
$panelAttributes = Helpers::add_class($panelAttributes, 'panel panel-default');
$bodyAttributes = array(
'class' => 'panel-collapse collapse',
'id' => "$name-$count"
);
$bodyAttributes = $count == $this->opened ? Helpers::add_class($bodyAttributes, 'in') : $bodyAttributes;
$string .= "<div" . Helpers::getContainer('html')->attributes($panelAttributes) . ">";
$string .= "<div class='panel-heading'>";
$string .= "<h4 class='panel-title'>";
$string .= "<a class='accordion-toggle' data-toggle='collapse' data-parent='#$name' href='#$name-$count'>";
$string .= $heading;
$string .= "</a>";
$string .= "</h4>";
$string .= "</div>";
$string .= "<div" . Helpers::getContainer('html')->attributes($bodyAttributes) . ">";
$string .= "<div class='panel-body'>";
$string .= $body;
$string .= "</div>";
$string .= "</div>";
$string .= "</div>";
$count += 1;
}
$string .= "</div>";
return $string;
}
示例5: __toString
public function __toString()
{
$string = "<div" . Helpers::getContainer('html')->attributes($this->attributes) . ">";
if ($this->header) {
$string .= "<div class='panel-heading'>";
$string .= "<h3 class='panel-title'>" . $this->header . "</h3>";
$string .= "</div>";
}
if ($this->body) {
$string .= "<div class='panel-body'>";
$string .= $this->body;
$string .= "</div>";
}
if ($this->footer) {
$string .= "<div class='panel-footer'>";
$string .= $this->footer;
$string .= "</div>";
}
$string .= "</div>";
return $string;
}
示例6: render
/**
* Outputs the current Dropdown in instance
*
* @return string A Dropdown menu
*/
public function render()
{
// Base class
$this->attributes = Helpers::add_class($this->attributes, 'btn-group');
// Pull right
$listAttributes = $this->pullRight ? array('class' => 'pull-right') : array();
// Dropup
if ($this->dropup) {
$this->attributes['class'] .= ' dropup';
}
$html = '<div' . Helpers::getContainer('html')->attributes($this->attributes) . '>';
//If split is false make this button dropdown
$html .= Form::button($this->label, array('class' => $this->type), !$this->split);
//Add split button if needed
if ($this->split) {
$html .= Form::button('', array('class' => $this->type), true);
}
$html .= Navigation::dropdown($this->links, $listAttributes, $this->autoroute);
$html .= '</div>';
return $html;
}
示例7: render
/**
* Writes the current Tabbable
*
* @return string A Bootstrap Tabbable
*/
public function render()
{
$content = array();
$list = static::normalize($this->menu, $content);
$tabs = Navigation::menu($list, $this->style, $this->stacked, $this->menu_attributes, $this->autoroute);
// Tab content container
if (!isset($this->content_attributes['class'])) {
$this->content_attributes['class'] = 'tab-content';
} else {
$this->content_attributes['class'] .= ' tab-content';
}
$content = '<div ' . Helpers::getContainer('html')->attributes($this->content_attributes) . '>' . implode('', $content) . '</div>';
$html = '<div class="tabbable ' . $this->placement . '"' . Helpers::getContainer('html')->attributes($this->attributes) . '>';
$html .= $this->placement === self::PLACEMENT_BELOW ? $content . $tabs : $tabs . $content;
$html .= '</div>';
return $html;
}
示例8: __toString
/**
* Prints out the MediaObject in memory
*
* @return string The HTML markup for the media object
*/
public function __toString()
{
// Whether objects should be printed as list elements or divs
$children = static::$listed ? 'li' : 'div';
// Open the media object
$attributes = Helpers::add_class($this->attributes, 'media');
$html = '<' . $children . Helpers::getContainer('html')->attributes($attributes) . '>';
// Add the media itself
$html .= '<a class="pull-' . $this->pull . '">';
$html .= $this->media;
$html .= '</a>';
// Add the title and body
$html .= '<div class="media-body">';
if ($this->title) {
$html .= $this->title;
}
$html .= $this->content;
// Render nested media objects (always as divs)
if ($this->nested) {
$listed = static::$listed;
static::$listed = false;
foreach ($this->nested as $mediaObject) {
$html .= $mediaObject;
}
static::$listed = $listed;
}
// Close body
$html .= '</div>';
// Close object
$html .= '</' . $children . '>';
return $html;
}
示例9: linkItem
/**
* Generates a link without doing a getting the full url from Laravel
*
* @param string $url Url for the link
* @param string $title Title for thel ink
* @param array $attributes Attributes to apply to the link
* @param bool $encode Encode title
* @param string $icon Icon for the link
*
* @return string
*/
protected static function linkItem($url, $title, $attributes = array(), $encode = true, $icon = null)
{
if ($encode) {
$title = Helpers::getContainer('html')->entities($title);
}
if (isset($icon)) {
$title = Icon::$icon() . ' ' . $title;
}
return '<a href="' . $url . '"' . Helpers::getContainer('html')->attributes($attributes) . '>' . $title . '</a>';
}
示例10: create
/**
* Creates a Bootstrap image
*
* @param string $type The image type
* @param string $url An url
* @param string $alt An alt text
* @param array $attributes An array of attributes
*
* @return string An img tag
*/
protected static function create($type, $url, $alt, $attributes)
{
$attributes = Helpers::add_class($attributes, 'img-' . $type);
return Helpers::getContainer('html')->image($url, $alt, $attributes);
}
示例11: render
/**
* Writes the current Navbar
*
* @return string A Bootstrap navbar
*/
public function render()
{
$attributes = Helpers::add_class($this->attributes, 'navbar ' . $this->type);
// Open navbar containers
$html = '<div' . Helpers::getContainer('html')->attributes($attributes) . '>';
$html .= '<div class="navbar-inner"><div class="container">';
// Collapsible button if asked for
if ($this->collapsible) {
$html .= '
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>';
}
// Add brand if one was given
if ($this->brand) {
$html .= Helpers::getContainer('html')->link($this->brand['url'], $this->brand['name'], array('class' => 'brand'));
}
if ($this->collapsible) {
$html .= '<div class="nav-collapse">';
}
// Prints out menus
if ($this->menus) {
foreach ($this->menus as $menu) {
if (is_string($menu)) {
$html .= $menu;
} else {
$attr = array_get($menu, 'attributes', array());
$html .= Navigation::unstyled($menu['items'], false, $attr, $this->autoroute);
}
}
}
if ($this->collapsible) {
$html .= '</div>';
}
// Close navbar containers
$html .= '</div></div></div>';
return $html;
}
示例12: render
/**
* Prints the current button in memory
*
* @return string A button
*/
public function render()
{
// Gather variables
extract($this->currentButton);
// Add btn to classes and fallback type
if (!isset($attributes['type'])) {
$attributes['type'] = 'button';
}
$attributes = Helpers::add_class($attributes, 'btn');
// Modify output if we have a dropdown
$caret = null;
if ($hasDropdown) {
$attributes = Helpers::add_class($attributes, 'dropdown-toggle');
$caret = ' <span class="caret"></span>';
$attributes['data-toggle'] = 'dropdown';
}
// Write output according to tag
$tag = 'button';
if ($type === 'link') {
$tag = 'a';
unset($attributes['type']);
}
return '<' . $tag . Helpers::getContainer('html')->attributes($attributes) . '>' . (string) $value . $caret . '</' . $tag . '>';
}
示例13: render
public function render()
{
return Helpers::getContainer('html')->image($this->url, $this->alt, $this->attributes);
}
示例14: render
/**
* Writes the current Navbar
*
* @return string A Bootstrap navbar
*/
public function render()
{
$type = (!empty($this->type)) ? ' ' . $this->type : '';
$attributes = Helpers::add_class($this->attributes, 'navbar' . $type);
// Open navbar containers
$html = '<nav' . Helpers::getContainer('html')->attributes($attributes) . ' role="navigation">';
$html .= '<div class="container">';
// --- Header ---
$html .= '<div class="navbar-header">';
// Collapsible button if asked for
if ($this->collapsible) {
$html .= '
<button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>';
}
// Add brand if one was given
if ($this->brand) {
$brand = $this->brand;
if ($brand['escape']) {
$html .= Helpers::getContainer('html')->link(
$this->brand['url'],
$this->brand['name'],
array('class' => 'navbar-brand')
);
} else {
$url = $brand['url'];
$text = $brand['name'];
$html .= "<a href='$url' class='navbar-brand'>$text</a>";
}
}
$html .= '</div>';
/// --- Header ---
// --- Content ---
$html .= '<div class="navbar-collapse collapse">';
// Prints out menus
if ($this->menus) {
foreach ($this->menus as $menu) {
if (is_string($menu)) {
$html .= $menu;
} // If is string add to html
else {
$attr = array_get($menu, 'attributes', array());
$html .= Navigation::unstyled($menu['items'], false, $attr, $this->autoroute);
}
}
}
$html .= '</div>';
// --- Content ---
// Close navbar containers
$html .= '</div></nav>';
return $html;
}
示例15: dl
/**
* Creates a definition list
*
* @param array $list An array [term => description]
* @param array $attributes An array of attributes
*
* @return string A formatted <dl> list
*/
public static function dl($list, $attributes = array())
{
$dl = null;
// Check if the list contains anything
if (count($list) == 0) {
return false;
}
// Write each entry
foreach ($list as $term => $description) {
$dl .= '<dt>' . Helpers::getContainer('html')->entities($term) . '</dt>';
$dl .= '<dd>' . Helpers::getContainer('html')->entities($description) . '</dd>';
}
return '<dl' . Helpers::getContainer('html')->attributes($attributes) . '>' . $dl . '</dl>';
}