本文整理汇总了PHP中html::escape方法的典型用法代码示例。如果您正苦于以下问题:PHP html::escape方法的具体用法?PHP html::escape怎么用?PHP html::escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::escape方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$fillFields['category_langs'][$category_lang->locale] = array('category_title' => $category_lang->category_title, 'category_description' => $category_lang->category_description);
}
?>
<tr id="<?php
echo $category_id;
?>
">
<td class="col-1 col-drag-handle"> </td>
<td class="col-2_sub">
<div class="post">
<h4><?php
echo html::escape($category_title);
?>
</h4>
<p><?php
echo html::escape($category_description);
?>
...</p>
</div>
</td>
<td class="col-3">
<?php
if (!empty($category_image)) {
echo "<img src=\"" . $category_image . "\">";
echo " [<a href=\"javascript:catAction('i','DELETE ICON','" . rawurlencode($category_id) . "')\">delete</a>]";
} else {
echo "<span class=\"swatch\" style=\"background-color: #" . $category_color . ";\"> </span>";
}
?>
</td>
<td class="col-4">
示例2: get_category_tree_data
/**
* Get categories as an tree array
* @param bool Get category count?
* @param bool Include hidden categories
* @return array
**/
public static function get_category_tree_data($count = FALSE, $include_hidden = FALSE)
{
// To hold the category data
$category_data = array();
// Database table prefix
$table_prefix = Kohana::config('database.default.table_prefix');
// Database instance
$db = new Database();
// Fetch the other categories
if ($count) {
$sql = "SELECT c.id, c.parent_id, c.category_title, c.category_color, c.category_image, c.category_image_thumb, COUNT(i.id) report_count " . "FROM " . $table_prefix . "category c " . "LEFT JOIN " . $table_prefix . "category c_parent ON (c.parent_id = c_parent.id) " . "LEFT JOIN " . $table_prefix . "incident_category ic ON (ic.category_id = c.id) " . "LEFT JOIN " . $table_prefix . "incident i ON (ic.incident_id = i.id AND i.incident_active = 1 ) " . "WHERE 1=1 " . (!$include_hidden ? "AND c.category_visible = 1 " : "") . (!$include_hidden ? "AND (c_parent.category_visible = 1 OR c.parent_id = 0)" : "") . "GROUP BY c.id " . "ORDER BY c.category_position ASC";
} else {
$sql = "SELECT c.id, c.parent_id, c.category_title, c.category_color, c.category_image, c.category_image_thumb " . "FROM " . $table_prefix . "category c " . "LEFT JOIN " . $table_prefix . "category c_parent ON (c.parent_id = c_parent.id) " . "WHERE 1=1 " . (!$include_hidden ? "AND c.category_visible = 1 " : "") . (!$include_hidden ? "AND (c_parent.category_visible = 1 OR c.parent_id = 0)" : "") . "ORDER BY c.category_position ASC";
}
// Create nested array - all in one pass
foreach ($db->query($sql) as $category) {
// If we didn't fetch report_count set fake value
if (!$count) {
$category->report_count = 0;
}
// If this is a parent category, just add it to the array
if ($category->parent_id == 0) {
// save children and report_count if already been created.
$children = isset($category_data[$category->id]['children']) ? $category_data[$category->id]['children'] : array();
$report_count = isset($category_data[$category->id]['report_count']) ? $category_data[$category->id]['report_count'] : 0;
$category_data[$category->id] = array('category_id' => $category->id, 'category_title' => html::escape(Category_Lang_Model::category_title($category->id)), 'category_description' => html::escape(Category_Lang_Model::category_description($category->id)), 'category_color' => $category->category_color, 'category_image' => $category->category_image, 'children' => $children, 'category_image_thumb' => $category->category_image_thumb, 'parent_id' => $category->parent_id, 'report_count' => $category->report_count + $report_count);
} else {
// If we haven't processed the parent yet, add placeholder parent category
if (!array_key_exists($category->parent_id, $category_data)) {
$category_data[$category->parent_id] = array('category_id' => $category->parent_id, 'category_title' => '', 'category_description' => '', 'parent_id' => 0, 'category_color' => '', 'category_image' => '', 'category_image_thumb' => '', 'children' => array(), 'report_count' => 0);
}
// Add children
$category_data[$category->parent_id]['children'][$category->id] = array('category_id' => $category->id, 'category_title' => html::escape(Category_Lang_Model::category_title($category->id)), 'category_description' => html::escape(Category_Lang_Model::category_description($category->id)), 'parent_id' => $category->parent_id, 'category_color' => $category->category_color, 'category_image' => $category->category_image, 'category_image_thumb' => $category->category_image_thumb, 'report_count' => $category->report_count, 'children' => array());
// Add to parent report count too
$category_data[$category->parent_id]['report_count'] += $category->report_count;
}
}
return $category_data;
}
示例3: get_javascript
/**
* Generates the JavaScript for stats tracking
*/
public static function get_javascript()
{
// Make sure cURL is installed
if (!function_exists('curl_exec')) {
throw new Kohana_Exception('footer.cURL_not_installed');
return false;
}
// Get the stat id
$stat_id = Settings_Model::get_setting('stat_id');
// If stats isn't set, ignore this
if ($stat_id == 0) {
return '';
}
$cache = Cache::instance();
$tag = $cache->get(Kohana::config('settings.subdomain') . '_piwiktag');
if (!$tag) {
// Cache is Empty so Re-Cache
// Grabbing the URL to update stats URL, Name, Reports, etc on the stats server
$additional_query = '';
if (isset($_SERVER["HTTP_HOST"])) {
// Grab the site domain from the config and trim any whitespaces
$site_domain = trim(Kohana::config('config.site_domain'));
$slashornoslash = '';
if (empty($site_domain) or $site_domain[0] != '/') {
$slashornoslash = '/';
}
// URL
$val = url::base();
$additional_query = '&val=' . base64_encode($val);
// Site Name
$site_name = html::escape(Kohana::config('settings.site_name'));
$additional_query .= '&sitename=' . base64_encode($site_name);
// Version
$version = Kohana::config('settings.ushahidi_version');
$additional_query .= '&version=' . base64_encode($version);
// Report Count
$number_reports = ORM::factory("incident")->where("incident_active", 1)->count_all();
$additional_query .= '&reports=' . base64_encode($number_reports);
// Latitude
$latitude = Kohana::config('settings.default_lat');
$additional_query .= '&lat=' . base64_encode($latitude);
// Longitude
$longitude = Kohana::config('settings.default_lon');
$additional_query .= '&lon=' . base64_encode($longitude);
}
$url = Kohana::config('config.external_site_protocol') . '://tracker.ushahidi.com/dev.px.php?task=tc&siteid=' . $stat_id . $additional_query;
$request = new HttpClient($url);
$buffer = $request->execute();
try {
// This works because the tracking code is only wrapped in one tag
$tag = (string) @simplexml_load_string($buffer);
} catch (Exception $e) {
// In case the xml was malformed for whatever reason, we will just guess what the tag should be here
$tag = <<<STATSCOLLECTOR
\t\t\t\t\t<!-- Stats Collector -->
\t\t\t\t\t<script type="text/javascript">
\t\t\t\t\tsetTimeout(function() {
\t\t\t\t\t\tvar statsCollector = document.createElement('img');
\t\t\t\t\t\t statsCollector.src = document.location.protocol + "//tracker.ushahidi.com/piwik/piwik.php?idsite={$stat_id}&rec=1";
\t\t\t\t\t\t statsCollector.style.cssText = "width: 1px; height: 1px; opacity: 0.1;";
\t\t\t\t\t\tdocument.body.appendChild(statsCollector);
\t\t\t\t\t}, 100);
\t\t\t\t\t</script>
\t\t\t\t\t<!-- End Stats Collector -->
STATSCOLLECTOR;
}
// Reset Cache Here
$cache->set(Kohana::config('settings.subdomain') . '_piwiktag', $tag, array('piwiktag'), 86400);
// 1 Day
}
return $tag;
}
示例4: rawurlencode
?>
</strong>
<br/><a href="<?php
echo $app->url;
?>
"><?php
echo $app->url;
?>
</a>
</td>
<td class="col-4" style="width:120px;">
<ul>
<li><a href="javascript:appAction('d','<?php
echo utf8::strtoupper(html::escape(Kohana::lang('ui_main.remove') . ' ' . $app->name));
?>
','<?php
echo rawurlencode($app->id);
?>
')" class="del"><?php
echo Kohana::lang('ui_main.remove');
?>
</a></li>
</ul>
</td>
</tr>
<?php
}
?>
示例5: foreach
<h4><?php
echo Kohana::lang('ui_main.reports_by_this_user');
?>
</h4>
<?php
foreach ($reports as $report) {
?>
<div class="rb_report">
<h5><a href="<?php
echo url::site();
?>
reports/view/<?php
echo $report->id;
?>
"><?php
echo html::escape($report->incident_title);
?>
</a></h5>
<p class="r_date r-3 bottom-cap"><?php
echo date('H:i M d, Y', strtotime($report->incident_date));
?>
</p>
<p class="r_location"><?php
echo html::specialchars($report->location->location_name);
?>
</p>
</div>
<?php
}
?>
</div>
示例6:
"><?php
echo Kohana::lang('ui_admin.mark_as');
?>
:</a></h4>
<?php
echo form::radio('action_approve', '0', TRUE) . ' ' . Kohana::lang('ui_main.disapprove');
?>
<br/>
<?php
echo form::radio('action_approve', '1', FALSE) . ' ' . Kohana::lang('ui_main.approve');
?>
</div>
<div class="tab_form_item" id="action_form_badge" style="margin-right:75px;">
<h4><a href="#" class="tooltip" title="<?php
echo html::escape(Kohana::lang("tooltips.actions.assign_badge"));
?>
"><?php
echo Kohana::lang('ui_admin.assign_badge');
?>
:</a></h4>
<?php
echo form::dropdown('action_badge', $badges);
?>
</div>
</div>
<div style="clear:both"></div>
<div class="tab_form_item">
示例7: date
$incident_id = $incident->id;
$incident_title = text::limit_chars(html::strip_tags($incident->incident_title), 40, '...', True);
$incident_date = $incident->incident_date;
$incident_date = date('M j Y', strtotime($incident->incident_date));
$incident_location = $incident->location->location_name;
?>
<tr>
<td><a href="<?php
echo url::site() . 'reports/view/' . $incident_id;
?>
"> <?php
echo $incident_title;
?>
</a></td>
<td><?php
echo html::escape($incident_location);
?>
</td>
<td><?php
echo $incident_date;
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<a class="more" href="<?php
echo url::site() . 'reports/';
?>
示例8: foreach
?>
</a></li>
<li><a href="<?php
echo url::site();
?>
feeds" class="rss-icon"><?php
echo Kohana::lang('ui_main.rss');
?>
</a></li>
</ul>
</div>
<?php
foreach ($feeds as $feed) {
$feed_id = $feed->id;
$feed_title = $feed->item_title;
$feed_description = text::limit_chars(html::escape($feed->item_description), 150, '...', True);
$feed_link = $feed->item_link;
$feed_date = date('M j Y', strtotime($feed->item_date));
$feed_source = "NEWS";
?>
<div class="post">
<h4><a href="<?php
echo $feed_link;
?>
" target="_blank"><?php
echo $feed_title;
?>
</a></h4>
<em class="date"><?php
echo $feed_source;
?>
示例9:
echo url::site() . 'reports/view/' . $incident_id;
?>
"> <?php
echo $incident_title;
?>
</a></td>
<td><?php
echo html::escape($how_feel);
?>
</td>
<td><?php
echo html::escape($why_feel);
?>
</td>
<td><?php
echo html::escape($change_place);
?>
</td>
<td><?php
if (!$incident_image) {
?>
No Image.<?php
} else {
?>
<img src="<?php
echo $incident_image;
?>
" style="max-width:100px;"><?php
}
?>
</td>
示例10: foreach
</tr>
<?php
}
foreach ($pages as $page) {
$page_id = $page->id;
$page_title = $page->page_title;
$page_tab = $page->page_tab;
$page_description = $page->page_description;
$page_active = $page->page_active;
?>
<tr>
<td class="col-1"> </td>
<td class="col-2">
<div class="post">
<h4><?php
echo html::escape($page_title);
?>
</h4>
<p><?php
echo text::limit_chars(html::strip_tags($page_description), "100", "...");
?>
</p>
</div>
</td>
<td class="col-4">
<ul>
<li class="none-separator"><a href="#add" onClick="fillFields(
'<?php
echo rawurlencode($page_id);
?>
示例11: set
public static function set($key, $value)
{
self::$primary[$key] = $value;
self::$escaped[$key] = html::escape($value);
}
示例12: html_escape
public function html_escape()
{
$that = clone $this;
$that->params = html::escape($that->params);
return $that;
}
示例13:
<?php
} else {
?>
<a href="javascript:sharingAction('v','SHOW',<?php
echo html::escape($site_id);
?>
)" class="status_yes"><?php
echo Kohana::lang('ui_main.hidden');
?>
</a>
<?php
}
?>
</li>
<li><a href="javascript:sharingAction('d','DELETE','<?php
echo html::escape($site_id);
?>
')" class="del"><?php
echo Kohana::lang('ui_main.delete');
?>
</a></li>
</ul>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
示例14: get_messages
/**
* Get messages according to a search criteria
*
* @param string search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default
* NB: Search criteria only affects IMAP mailboxes.
* @param string date format. Set to "Y-m-d H:i:s" by default
* @return mixed array containing messages
*/
public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s")
{
global $htmlmsg, $plainmsg, $attachments;
// If our imap connection failed earlier, return no messages
if ($this->imap_stream == false) {
return array();
}
// Use imap_search() to find the 'UNSEEN' messages.
// This is more efficient than previous code using imap_num_msg()
$new_msgs = imap_search($this->imap_stream, 'UNSEEN');
$max_imap_messages = Kohana::config('email.max_imap_messages');
if ($new_msgs == null) {
return array();
}
// Check to see if the number of messages we want to sort through is greater than
// the number of messages we want to allow. If there are too many messages, it
// can fail and that's no good.
$msg_to_pull = sizeof($new_msgs);
// This check has had problems in the past
if ($msg_to_pull > $max_imap_messages) {
$msg_to_pull = $max_imap_messages;
}
$messages = array();
for ($msgidx = 0; $msgidx < $msg_to_pull; $msgidx++) {
$msgno = $new_msgs[$msgidx];
$header = imap_headerinfo($this->imap_stream, $msgno);
if (!isset($header->message_id) or !isset($header->udate)) {
continue;
}
// Skip messages that aren't new/unseen
// not sure we need this check now we use imap_search to pull only UNSEEN
if ($header->Unseen != 'U' and $header->Recent != 'N') {
continue;
}
$message_id = $header->message_id;
$date = date($date_format, $header->udate);
if (isset($header->from)) {
$from = $header->from;
} else {
$from = FALSE;
}
$fromname = "";
$fromaddress = "";
$subject = "";
$body = "";
$attachments = "";
if ($from != FALSE) {
foreach ($from as $id => $object) {
if (isset($object->personal)) {
$fromname = $object->personal;
}
if (isset($object->mailbox) and isset($object->host)) {
$fromaddress = $object->mailbox . "@" . $object->host;
}
if ($fromname == "") {
// In case from object doesn't have Name
$fromname = $fromaddress;
}
}
}
if (isset($header->subject)) {
$subject = $this->_mime_decode($header->subject);
}
// Fetch Body
$this->_getmsg($this->imap_stream, $msgno);
if ($htmlmsg) {
// Convert HTML to Text
$html2text = new Html2Text($htmlmsg);
$htmlmsg = $html2text->get_text();
}
$body = $plainmsg ? $plainmsg : $htmlmsg;
// Fetch Attachments
$attachments = $this->_extract_attachments($this->imap_stream, $msgno);
// This isn't the perfect solution but windows-1256 encoding doesn't work with mb_detect_encoding()
// so if it doesn't return an encoding, lets assume it's arabic. (sucks)
if (mb_detect_encoding($body, 'auto', TRUE) == '') {
$body = iconv("windows-1256", "UTF-8", $body);
}
// Convert to valid UTF8
$detected_encoding = mb_detect_encoding($body, "auto");
if ($detected_encoding == 'ASCII') {
$detected_encoding = 'iso-8859-1';
}
$body = mb_convert_encoding($body, $detected_encoding, 'UTF-8');
$body = html::escape($body);
$subject = html::strip_tags($subject);
array_push($messages, array('message_id' => $message_id, 'date' => $date, 'from' => $fromname, 'email' => $fromaddress, 'subject' => $subject, 'body' => $body, 'attachments' => $attachments));
// Mark Message As Read
imap_setflag_full($this->imap_stream, $msgno, "\\Seen");
}
return $messages;
}
示例15: main
public function main()
{
?>
<div id="main">
<div id="reports-new">
<div class="ui error form segment square-corners no-shadow">
<div class="three fields">
<div class="field">
<label>Год набора</label>
<input id="year" name="year" placeholder="<?php
echo date::year();
?>
" type="text" value="<?php
echo $this->report->year;
?>
">
</div>
<div class="field">
<label>Срок обучения (лет)</label>
<input id="duration" name="duration" placeholder="4" type="text" value="<?php
echo $this->report->duration;
?>
" onchange="calendar.update();">
</div>
<div class="field">
<label>ФИО ректора</label>
<input id="rector" name="rector" placeholder="М.П. Батура" type="text" value="<?php
echo $this->report->rector;
?>
">
</div>
</div>
<div class="field">
<label>Регистрационный номер учебного плана</label>
<input id="registration_number" name="registration_number" placeholder="2014.09.20/000" type="text" value="<?php
echo $this->report->registration_number;
?>
">
</div>
<div class="field">
<div class="ui fluid selection dropdown">
<div class="default text">Форма обучения</div>
<i class="dropdown icon"></i>
<input type="hidden" id="training_form_id" name="training_form_id" value="<?php
echo $this->report->training_form_id;
?>
">
<div class="menu">
<?php
$training_forms = training_forms::get();
if ($training_forms) {
foreach ($training_forms as $training_form) {
?>
<div class="item" data-value="<?php
echo $training_form->id;
?>
"><?php
echo html::escape($training_form->name);
?>
</div>
<?php
}
}
?>
</div>
</div>
</div>
<div class="field">
<div class="ui fluid selection dropdown">
<div class="default text">Квалификация специалиста</div>
<i class="dropdown icon"></i>
<input type="hidden" id="qualification_id" name="qualification_id" value="<?php
echo $this->report->qualification_id;
?>
">
<div class="menu">
<?php
$qualifications = qualifications::get();
if ($qualifications) {
foreach ($qualifications as $qualification) {
?>
<div class="item" data-value="<?php
echo $qualification->id;
?>
"><?php
echo html::escape($qualification->name);
?>
</div>
<?php
}
}
?>
</div>
</div>
</div>
//.........这里部分代码省略.........