Example #1
0
 /**
  * @param string $id
  * @param string $title
  * @param string $content
  */
 public function __construct($id = '', $title = null, $content = null)
 {
     $this->addClass('collapse-wrapper');
     $this->link = new GenericTag('a');
     $this->link->setAttribute('data-toggle', 'collapse');
     $this->title = new GenericTag('legend', $this->link);
     $this->content = new GenericTag('div');
     $this->content->addClass('collapse');
     $this->content->setAttribute('id', $id);
     $this->setCollapseStateIndicators();
     parent::__construct('fieldset', $content);
     $this->setTitleContent($title);
 }
Example #2
0
 /**
  * @param string $content
  * @param string $type Const Alert::TYPE_.
  * @param bool   $withDismissButton Default is true.
  */
 public function __construct($content = null, $type = self::TYPE_INFO, $withDismissButton = true)
 {
     $this->addClass('alert');
     if (!in_array($type, $this->types)) {
         $type = self::TYPE_INFO;
     }
     $this->addClass('alert-' . $type);
     parent::__construct('div', $content);
     if ($withDismissButton) {
         $this->addDefaultDismissButton();
     }
 }
Example #3
0
 /**
  * @param	mixed	$data	style content
  * @param	string	$type	
  * @param	string	$sep	content separator 
  * @return	StyleTag
  */
 public function __construct($data = null, $type = null, $sep = null)
 {
     $this->disableRenderWhenEmpty();
     if (empty($type) || !is_string($type)) {
         $type = 'text/css';
     }
     if (null === $sep) {
         $sep = PHP_EOL;
     }
     $content = new TagContent($data, $sep);
     $attrs = new TagAttributes(array('media', 'scope', 'type'));
     $attrs->add('type', $type);
     parent::__construct('style', $content, $attrs);
 }
Example #4
0
 /**
  * @param	string	$href	url or file path to resource
  * @param	string	$rel	relationship between current doc and link
  * @param	string  $type	mime type
  * @return	LinkTag
  */
 public function __construct($href, $rel = null, $type = null)
 {
     if (empty($href) || !is_string($href)) {
         $err = 'href must be a non empty string';
         throw new InvalidArgumentException($err);
     }
     parent::__construct('link');
     $this->disableClosingTag();
     $attrs = $this->getTagAttributes();
     $attrs->loadWhiteList(array('href', 'hreflang', 'media', 'rel', 'sizes', 'type'));
     if (empty($rel) || !is_string($rel)) {
         $rel = 'stylesheet';
     }
     if (empty($type) || !is_string($type)) {
         $type = 'text/css';
     }
     $attrs->add('rel', $rel)->add('type', $type)->add('href', $href);
 }
Example #5
0
 /**
  * @param	string	$href	url or file path to resource
  * @param	string	$rel	relationship between current doc and link
  * @param	string  $type	mime type
  * @return	LinkTag
  */
 public function __construct($href, $content = null)
 {
     if (empty($href) || !is_string($href)) {
         $err = 'href must be a non empty string';
         throw new InvalidArgumentException($err);
     }
     parent::__construct('a');
     $attrs = $this->getTagAttributes();
     $attrs->loadWhiteList(array('href', 'hreflang', 'media', 'rel', 'target'));
     $attrs->add('rel', $rel)->add('type', $type)->add('href', $href);
     if (null !== $content) {
         if (is_array($content)) {
             $this->loadContent($content);
         } else {
             $this->addContent($content);
         }
     }
 }
Example #6
0
 /**
  * Only has two valid attributes href and target
  *
  * @param	string	$name
  * @param	string	$content
  * @param	string	$httpEquiv
  * @param	string	$charset
  * @return	MetaTag
  */
 public function __construct($name = null, $content = null, $httpEquiv = null, $charset = null)
 {
     parent::__construct('meta');
     $attrs = $this->getTagAttributes();
     $attrs->loadWhiteList(array('charset', 'content', 'http-equiv', 'name'));
     if (null !== $httpEquiv) {
         $attrs->add('http-equiv', $httpEquiv);
     }
     if (null !== $name) {
         $attrs->add('name', $name);
     }
     if (null !== $content) {
         $attrs->add('content', $content);
     }
     if (null !== $charset) {
         $attrs->add('charset', $charset);
     }
     $this->disableClosingTag();
 }
Example #7
0
 /**
  * @param	string	$href	url or file path to resource
  * @param	string	$rel	relationship between current doc and link
  * @param	string  $type	mime type
  * @return	LinkTag
  */
 public function __construct($src, $width = null, $height = null, $alt = null)
 {
     if (empty($href) || !is_string($href)) {
         $err = 'href must be a non empty string';
         throw new InvalidArgumentException($err);
     }
     parent::__construct('img');
     $attrs = $this->getTagAttributes();
     $attrs->loadWhiteList(array('alt', 'src', 'usemap', 'ismap', 'height', 'width'));
     $this->setSource($src);
     if (null !== $width) {
         $this->setWidth($width);
     }
     if (null !== $height) {
         $this->setHeight($height);
     }
     if (null !== $alt) {
         $this->setAlt($alt);
     }
 }
Example #8
0
 /**
  * @param string $title
  * @param string $level
  * @return $this
  */
 public function addTitle($title, $level = 'h4')
 {
     $titleWrapper = new GenericTag($level, $title);
     $titleWrapper->addClass('modal-title');
     $this->getHeader()->appendContent($titleWrapper);
     return $this;
 }
Example #9
0
 /**
  * @param	string	$data	content for the title
  * @return	Title
  */
 public function __construct($data = null, $sep = ' ')
 {
     $content = new TagContent($data, $sep);
     parent::__construct('title', $content);
     $this->disableRenderWhenEmpty();
 }