phpdoc/Library/Helper/Html.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="robots" content="index, follow, all" />
<title>Library\Helper\Html | Library</title>
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../../css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="../../css/sami.css">
<script src="../../js/jquery-1.11.1.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/typeahead.min.js"></script>
<script src="../../sami.js"></script>
<meta name="MobileOptimized" content="width">
<meta name="HandheldFriendly" content="true">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
</head>
<body id="class" data-name="class:Library_Helper_Html" data-root-path="../../">
<div id="content">
<div id="left-column">
<div id="control-panel">
<form id="search-form" action="../../search.html" method="GET">
<span class="glyphicon glyphicon-search"></span>
<input name="search"
class="typeahead form-control"
type="search"
placeholder="Search">
</form>
</div>
<div id="api-tree"></div>
</div>
<div id="right-column">
<nav id="site-nav" class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-elements">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">Library</a>
</div>
<div class="collapse navbar-collapse" id="navbar-elements">
<ul class="nav navbar-nav">
<li><a href="../../classes.html">Classes</a></li>
<li><a href="../../namespaces.html">Namespaces</a></li>
<li><a href="../../interfaces.html">Interfaces</a></li>
<li><a href="../../traits.html">Traits</a></li>
<li><a href="../../doc-index.html">Index</a></li>
<li><a href="../../search.html">Search</a></li>
</ul>
</div>
</div>
</nav>
<div class="namespace-breadcrumbs">
<ol class="breadcrumb">
<li><span class="label label-default">class</span></li>
<li><a href="../../Library.html">Library</a></li>
<li><a href="../../Library/Helper.html">Helper</a></li>
<li>Html</li>
</ol>
</div>
<div id="page-content">
<div class="page-header">
<h1>Html</h1>
</div>
<p> class
<strong>Html</strong>
</p>
<div class="description">
<p>HTML language helper</p> <p>As for all helpers, all methods are statics.</p>
<p>For convenience, the best practice is to use:</p>
<pre><code>use Library\Helper\Html as HtmlHelper;
</code></pre>
</p> </div>
<h2>Properties</h2>
<table class="table table-condensed">
<tr>
<td class="type" id="property_dom_id_register">
static
</td>
<td>$dom_id_register</td>
<td class="last">The global DOM IDs register</td>
<td></td>
</tr>
<tr>
<td class="type" id="property_html_tag_closure">
static
</td>
<td>$html_tag_closure</td>
<td class="last">
</td>
<td></td>
</tr>
</table>
<h2>Methods</h2>
<div class="container-fluid underlined">
<div class="row">
<div class="col-md-2 type">
static
bool
</div>
<div class="col-md-8 type">
<a href="#method_hasId">hasId</a>(
string $reference)
<p>Verify if a reference is already defined in the DOM IDs register</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_getId">getId</a>(
string $reference = null,
string|bool $base_id = null)
<p>Get a DOM unique ID</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_getNewId">getNewId</a>(
string $reference = null,
string|bool $base_id = null)
<p>Create and get a new DOM unique ID</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
</div>
<div class="col-md-8 type">
<a href="#method_setHtmlTagClosure">setHtmlTagClosure</a>(
string $closure)
<p>Set the HTML tags closure (<code>/></code> by default)</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_writeHtmlTag">writeHtmlTag</a>(
string $tag_name,
string $content = '',
array $attrs = array(),
bool $intag_close = false)
<p>Build an HTML string for a specific tag with attributes</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_parseAttributes">parseAttributes</a>(
array $attrs = array())
<p>Build an attributes HTML string from an array like <code>variable => value</code> pairs</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_javascriptProtect">javascriptProtect</a>(
string $str = '',
bool $protect_quotes = false)
<p>Build an HTML string to use in javascripts attributes or functions</p> </div>
<div class="col-md-2"></div>
</div>
</div>
<h2>Details</h2>
<div id="method-details">
<div class="method-item">
<h3 id="method_hasId">
<div class="location">at line 55</div>
<code> static
bool
<strong>hasId</strong>(
string $reference)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Verify if a reference is already defined in the DOM IDs register</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$reference</td>
<td>The reference to search</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
bool</td>
<td>True if the reference exists in the register, false otherwise</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getId">
<div class="location">at line 67</div>
<code> static
string
<strong>getId</strong>(
string $reference = null,
string|bool $base_id = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get a DOM unique ID</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$reference</td>
<td>A reference used to store the ID (and retrieve it - by default, a uniqid)</td>
</tr>
<tr>
<td>
string|bool</td>
<td>$base_id</td>
<td>A string that will be used to construct the ID, if set to <code>true</code>, the reference will be used as <code>$base_id</code>)</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The unique ID created or the existing one for the reference if so</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getNewId">
<div class="location">at line 85</div>
<code> static
string
<strong>getNewId</strong>(
string $reference = null,
string|bool $base_id = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Create and get a new DOM unique ID</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$reference</td>
<td>A reference used to store the ID (and retrieve it - by default, a uniqid)</td>
</tr>
<tr>
<td>
string|bool</td>
<td>$base_id</td>
<td>A string that will be used to construct the ID, if set to <code>true</code>, the reference will be used as <code>$base_id</code>)</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The unique ID created</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_setHtmlTagClosure">
<div class="location">at line 119</div>
<code> static
<strong>setHtmlTagClosure</strong>(
string $closure)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Set the HTML tags closure (<code>/></code> by default)</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$closure</td>
<td>The tag closure string</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_writeHtmlTag">
<div class="location">at line 133</div>
<code> static
string
<strong>writeHtmlTag</strong>(
string $tag_name,
string $content = '',
array $attrs = array(),
bool $intag_close = false)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Build an HTML string for a specific tag with attributes</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$tag_name</td>
<td>The tag name</td>
</tr>
<tr>
<td>
string</td>
<td>$content</td>
<td>The tag content</td>
</tr>
<tr>
<td>
array</td>
<td>$attrs</td>
<td>An attributes array</td>
</tr>
<tr>
<td>
bool</td>
<td>$intag_close</td>
<td>Can this kind of tag be directly closed (default is <code>false</code>)</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The HTML string for the tag</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_parseAttributes">
<div class="location">at line 150</div>
<code> static
string
<strong>parseAttributes</strong>(
array $attrs = array())</code>
</h3>
<div class="details">
<div class="method-description">
<p>Build an attributes HTML string from an array like <code>variable => value</code> pairs</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
array</td>
<td>$attrs</td>
<td>The attributes array</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The attributes string ready for HTML insertion</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_javascriptProtect">
<div class="location">at line 166</div>
<code> static
string
<strong>javascriptProtect</strong>(
string $str = '',
bool $protect_quotes = false)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Build an HTML string to use in javascripts attributes or functions</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$str</td>
<td>The HTML string to protect</td>
</tr>
<tr>
<td>
bool</td>
<td>$protect_quotes</td>
<td>Protect all quotes (simple and double) with a slash</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The HTML string ready for javascript insertion</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
Generated by <a href="http://sami.sensiolabs.org/">Sami, the API Documentation Generator</a>.
</div>
</div>
</div>
</body>
</html>