本文整理汇总了PHP中html函数的典型用法代码示例。如果您正苦于以下问题:PHP html函数的具体用法?PHP html怎么用?PHP html使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_processing_script
public static function print_processing_script($order)
{
echo html('p', __('Your Order is strill being processed. Please wait a few seconds...', 'colabsthemes'));
echo html('p', sprintf(__('If your Order does not complete soon, please contact us and refer to your Order ID - #%d.', 'colabsthemes'), $order->get_id()));
$page = $_SERVER['REQUEST_URI'];
header("Refresh:5; url={$page}");
}
示例2: wrap
/**
* Mark the field as editable
*
* @param string $content Filtered content
* @param mixed $data Additional data like an object id etc.
*
* @return string Wrapped content
*/
public function wrap($content, $data)
{
if (!$this->allow($data)) {
return $content;
}
$data = wp_parse_args($data, array('type' => $this->input_type));
if ('rich' == $data['type'] && !FEE_Core::$options->rich) {
$data['type'] = 'textarea';
}
self::$wrapped[$data['type']] = true;
if (is_null($content)) {
$content = '';
}
if (!is_scalar($content)) {
trigger_error("scalar expected. " . gettype($content) . " given", E_USER_WARNING);
}
$data = apply_filters('front_end_editor_wrap', $data, $this->filter);
$data['filter'] = $this->filter;
$data_attr = array();
foreach ($data as $key => $value) {
if (!is_scalar($value)) {
$value = json_encode($value);
}
$data_attr["data-{$key}"] = $value;
}
$data_attr['class'] = 'fee-field';
if ($this->was_placeholded) {
$data_attr['title'] = FEE_Core::get_title($this->filter);
}
$wrap_tag = in_array($data['type'], array('textarea', 'rich', 'widget')) ? 'div' : 'span';
if ('div' == $wrap_tag) {
$data_attr['class'] .= ' fee-clearfix';
}
return html($wrap_tag, $data_attr, $content);
}
示例3: show
function show()
{
$docs = _class('docs');
$dir = $docs->docs_dir;
$dir_len = strlen($dir);
$ext = '.stpl';
$ext_len = strlen($ext);
$name = preg_replace('~[^a-z0-9/_-]+~ims', '', $_GET['id']);
if (strlen($name)) {
$dev_path = YF_PATH . '.dev/samples/classes/';
$dev_class_path = $dev_path . $name . '.class.php';
if (file_exists($dev_class_path)) {
return _class($name, $dev_path)->show();
}
$f = $dir . $name . '.stpl';
if (!file_exists($f)) {
return _404('Not found');
}
return '<section class="page-contents">' . tpl()->parse_string(file_get_contents($f), $replace, 'doc_' . $name) . '</section>';
}
$url = rtrim(url('/@object/@action/')) . '/';
$data = [];
foreach ((array) $this->_get_misc_docs($dir) as $name) {
$data[$name] = ['name' => $name, 'link' => $url . urlencode($name)];
}
ksort($data);
return html()->li($data);
}
示例4: render
/**
*
* @since 2.0.0
*
* @return string
*/
public function render()
{
$introduction = html('div class="intro-text"', html('h2', __('Send Posts to Subscribers', 'Postmatic')), html('p', __('Posts are sent as soon as you hit publish.<br /> Comments can be sent with a simple reply.', 'Postmatic')));
$table_entries = array(array('title' => __('Author Subscriptions', 'Postmatic'), 'type' => 'checkbox', 'name' => 'auto_subscribe_authors', 'desc' => __('Subscribe authors to comments on their own posts.<small>(Recommended)</small>', 'Postmatic') . html('p', __('This will automatically subscribe post authors to new comment notifications on their posts. This works well to keep the author up to date with the latest comments and discussion.', 'Postmatic'))), array('title' => __('User Accounts', 'Postmatic'), 'type' => 'checkbox', 'name' => 'send_login_info', 'desc' => __('Email subscribers WordPress account credentials when they subscribe.', 'Postmatic') . html('p', __('Only necessary in some situations as all user commands are otherwise possible via email. If enabled we recommend using a good front end login plugin.', 'Postmatic'))), array('title' => __('Choose Posts to Deliver', 'Postmatic'), 'type' => 'checkbox', 'name' => 'no_post_email_default', 'desc' => __('Do not send new posts unless I choose to.', 'Postmatic') . html('p', __('Uncheck the "Do not deliver this post via email" checkbox before publishing to deliver a specific post.', 'Postmatic'))), array('title' => __('Default sending mode', 'Postmatic'), 'type' => 'checkbox', 'name' => 'excerpt_default', 'desc' => __('Send only the excerpt instead of the full post content.', 'Postmatic') . html('p', __('Enable this setting to only send excerpts with a button to read more online. You can override this on a per-post basis when drafting a new post. Note that the user will not be able to reply to the email to leave a comment because... well... who can comment on an excerpt?', 'Postmatic'))));
$this->override_entries($table_entries);
return $introduction . $this->form_table($table_entries);
}
示例5: document
function document()
{
set("title", "Documents");
set("data", Document::getAll());
set("promos", Promo::getAll());
return html("list.html.php", "layout.html.php");
}
示例6: input
public function input()
{
$input = parent::input();
if (isset($this->data)) {
$input->data('url', html(json_encode($this->data), false));
} else {
if ($page = $this->page()) {
foreach ($page->files() as $file) {
if ($file->type() == 'image') {
$media[$file->name()]['orientation'] = (string) $file->orientation();
$media[$file->name()]['thumbnail'] = (string) $file->url();
$media[$file->name()]['width'] = (string) $file->width();
$media[$file->name()]['height'] = (string) $file->height();
}
if ($media[$file->name()]['type'] != 'video') {
$media[$file->name()]['type'] = (string) $file->type();
}
$media[$file->name()][$file->extension()] = (string) $file->url();
$media[$file->name()]['url'] = (string) $file->url();
$media[$file->name()]['name'] = (string) $file->name();
}
$mediajson = html(json_encode($media));
$input->data(array('media' => $mediajson, 'field' => 'gallery'));
}
}
//$input->tag('div');
//$input->removeAttr('type');
//$input->removeAttr('value');
return $input;
}
示例7: indexAction
public function indexAction()
{
// Display the send_us_a_file.html page if the "Send us a file" feature is on and the user is not logged in.
if (fz_config_get('app', 'send_us_a_file_feature') && false == $this->getUser()) {
set('start_from', Zend_Date::now()->get(Zend_Date::DATE_SHORT));
$maxUploadSize = min(Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('upload_max_filesize')), Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('post_max_size')));
set('max_upload_size', $maxUploadSize);
return html('send_us_a_file.html');
}
$this->secure();
$user = $this->getUser();
$freeSpaceLeft = max(0, Fz_Db::getTable('File')->getRemainingSpaceForUser($user));
$maxUploadSize = min(Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('upload_max_filesize')), Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('post_max_size')), $freeSpaceLeft);
$progressMonitor = fz_config_get('app', 'progress_monitor');
$progressMonitor = new $progressMonitor();
set('upload_id', md5(uniqid(mt_rand(), true)));
set('start_from', Zend_Date::now()->get(Zend_Date::DATE_SHORT));
set('refresh_rate', 1200);
set('files', Fz_Db::getTable('File')->findByOwnerOrderByUploadDateDesc($user));
set('use_progress_bar', $progressMonitor->isInstalled());
set('upload_id_name', $progressMonitor->getUploadIdName());
set('free_space_left', $freeSpaceLeft);
set('max_upload_size', $maxUploadSize);
set('sharing_destinations', fz_config_get('app', 'sharing_destinations', array()));
set('disk_usage', array('space' => '<b id="disk-usage-value">' . bytesToShorthand(Fz_Db::getTable('File')->getTotalDiskSpaceByUser($user)) . '</b>', 'quota' => fz_config_get('app', 'user_quota')));
return html('main/index.php');
}
示例8: _modal
/**
* Render a modal
*
* @param \FrenchFrogs\Polliwog\Modal\Modal\Bootstrap $modal
* @return string
*/
public function _modal(Modal\Bootstrap $modal)
{
$html = '';
// header
if ($modal->hasCloseButton()) {
$html .= html('button', ['type' => 'button', 'class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => $modal->getCloseButtonLabel()], '<span aria-hidden="true">×</span>');
}
if ($modal->hasTitle()) {
$html .= html('h4', ['class' => static::MODAL_HEADER_TITLE_CLASS], $modal->getTitle());
}
$html = html('div', ['class' => static::MODAL_HEADER_CLASS], $html);
// body
$html .= html('div', ['class' => static::MODAL_BODY_CLASS], $modal->getBody());
// footer
if ($modal->hasActions()) {
$actions = '';
if ($modal->hasCloseButton()) {
$actions .= html('button', ['type' => 'button', 'class' => 'btn btn-default', 'data-dismiss' => 'modal'], $modal->getCloseButtonLabel());
}
foreach ($modal->getActions() as $action) {
/** @var Element\Button $action */
$actions .= html('button', $action->getAttributes(), $action->getLabel());
}
$html .= html('div', ['class' => static::MODAL_FOOTER_CLASS], $actions);
}
// container
if (!$modal->isOnlyContent()) {
$html = html('div', ['class' => static::MODAL_CONTENT_CLASS, 'role' => 'document'], $html);
$html = html('div', ['class' => static::MODAL_CLASS, 'role' => 'dialog'], $html);
}
return $html;
}
示例9: mark_automatically
public function mark_automatically($student_answer, &$log)
{
$this->msg->set_root('/auto-marking');
$log = array();
if (!$this->auto_marking_method) {
throw new Exception($this->msg->_('cannot-mark-type-none'));
}
if (!is_string($student_answer)) {
throw new Exception($this->msg->_('invalid-format'));
}
$clean_answer = Util::remove_useless_whitespaces($student_answer);
$log[] = ['sa-running', []];
$log[] = ['sa-pattern', [html($this->raw_answer)]];
$log[] = ['sa-given-answer', [html($student_answer)]];
$log[] = ['sa-given-answer-clean', [html($clean_answer)]];
if (preg_match($this->answer, $student_answer) || preg_match($this->answer, $clean_answer)) {
$log[] = ['sa-result-correct', []];
$mark = 1;
} else {
$log[] = ['sa-result-incorrect', []];
$mark = 0;
}
$log[] = ['mark', array('mark' => $mark)];
return $mark;
}
示例10: show
/**
*/
public function show()
{
css('
#faq-search { padding-top: 20px; }
#faq-items { padding-top: 20px; padding-bottom: 20px; }
#faq-items li.li-header { list-style: none; display:none; }
#faq-items li.li-level-0 { display: block; font-size: 15px; }
#faq-items li.li-level-1 { padding-top: 10px; font-size: 13px; }
span.highlight { background-color: #ff0; }
');
asset('jquery-highlight');
jquery('
var url_hash = window.location.hash.replace("/", "");
if (url_hash) {
$("li.li-level-0" + url_hash + " .li-level-1", "#faq-items").show();
}
$(".li-level-0", "#faq-items").click(function(){
$(".li-level-1", this).toggle()
})
$("input#search", "#faq-search").on("change keyup", function(){
var words = $(this).val();
$("#faq-items").unhighlight();
$("#faq-items").highlight(words);
$(".li-level-1").hide().filter(":has(\'span.highlight\')").show();
})
');
$items = [];
foreach ((array) db()->from(self::table)->where('active', 1)->where('locale', conf('language'))->get_all() as $a) {
$items[$a['id']] = ['parent_id' => $a['parent_id'], 'name' => _truncate(trim($a['title']), 60, true, '...'), 'link' => url('/@object/#/faq' . $a['id']), 'id' => 'faq' . $a['id']];
if ($a['text']) {
$items['1111' . $a['id']] = ['parent_id' => $a['id'], 'body' => trim($a['text'])];
}
}
return tpl()->parse_string($this->_tpl, ['items' => html()->li_tree($items)]);
}
示例11: show
function show(&$smarty, $tmp, $setting, &$html, $lv = 0, &$limit)
{
if ($setting['shownode'] && $lv != 0) {
if (is_object($smarty) && method_exists($smarty, 'gen_url')) {
$url = $smarty->gen_url(array('app' => 'content', 'ctl' => 'site_article', 'act' => 'lists', 'arg0' => $tmp['info']['node_id']));
}
$html .= html($lv, $url, $tmp['info']['node_name']);
}
if (!$setting['shownode']) {
if ($limit <= 0) {
return;
}
#$tmp['article'] = array_slice( $tmp['article'], 0, $setting['limit'] );
}
if ($tmp['article']) {
if ($setting['styleart']) {
$tmp_lv = $setting['shownode'] ? $setting['lv'] + 1 : 2;
} else {
$tmp_lv = $lv + 1;
}
foreach ($tmp['article'] as $row) {
if (is_object($smarty) && method_exists($smarty, 'gen_url')) {
$url = $smarty->gen_url(array('app' => 'content', 'ctl' => 'site_article', 'act' => 'index', 'arg0' => $row['article_id']));
}
$html .= html($tmp_lv, $url, $row['title']);
$limit--;
}
}
if ($tmp['child']) {
foreach ($tmp['child'] as $row) {
show($smarty, $row, $setting, $html, $lv + 1, $limit);
}
}
}
示例12: markdown2html
function markdown2html($text)
{
$text = html($text);
//bold text
$text = preg_replace('/__(.+?)__/s', '<strong>$1</strong>', $text);
$text = preg_replace('/\\*\\*(.+?)\\*\\*/s', '<strong>$1</strong>', $text);
//italic text
$text = preg_replace('/_([^_]+)_/', '<em>$1</em>', $text);
$text = preg_replace('/\\*([^\\*]+)\\*/', '<em>$1</em>', $text);
//преобразование стиля Windows (\r\n) в стиль Unix (\n)
$text = preg_replace('/\\r\\n/', "\n", $text);
//преобразуем стиль MacOS (\r) в Unix (\n)
$text = preg_replace('/\\r/', "\n", $text);
//Абзацы. Изначальный вид >>> $text = '<p>' . preg_replace('/\n\n/', '<p></p>', $text) . '</p>'; <<< но получается слишком большое расстояние, видимо из-за двойных <p>
$text = preg_replace('/\\n\\n/', '<p></p>', $text);
//разрывы строки
$text = preg_replace('/\\n/', '<br>', $text);
// [linked text](link URL)
$text = preg_replace('/\\[([^\\]]+)]\\(([-a-z0-9._~:\\/?#@!$&\'()*+,;=%]+)\\)/i', '<a href="$2">$1</a>', $text);
// // Преобразуем стиль Windows (\r\n) в Unix (\n). Иногда вместо preg_replace можно и нужно использовать str_replace
// $text = str_replace("\r\n", "\n", $text);
// // Преобразуем стиль Macintosh (\r) в Unix (\n).
// $text = str_replace("\r", "\n", $text);
// // Абзацы
// $text = '<p>' . str_replace("\n\n", '</p><p>'# $text) . '</p>';
// // Разрывы строк
// $text = str_replace("\n", 1<br>1, $text);
return $text;
}
示例13: ready_content
protected function ready_content()
{
$content = '';
$content .= $this->send_login_warning_content();
$content .= html('input', array('name' => $this->import_type_name, 'type' => 'hidden', 'value' => $this->import_type));
return $this->form_wrap($content, array('value' => __('Import from Subscribe To Comments Reloaded', 'Postmatic')));
}
示例14: show
/**
*/
function show()
{
$deepness = 3;
$ext = '.stpl';
$ext_len = strlen($ext);
foreach ((array) $this->_dir_array as $gname => $glob) {
foreach (range(1, $deepness) as $deep) {
$glob_pattern = $glob . '*' . str_repeat('/*', $deep) . $ext;
foreach (glob($glob_pattern) as $path) {
$name = substr(implode('/', array_reverse(array_slice(array_reverse(explode('/', $path)), 0, $deep))), 0, -$ext_len);
$names[$name][$path] = $path;
$theme = implode(array_slice(array_reverse(explode('/', $path)), $deep, 1));
$found_in[$path] = $gname . ' | ' . $theme;
}
}
}
ksort($names);
foreach ((array) $names as $name => $paths) {
$links = [];
foreach ($paths as $path) {
$links[] = a('/file_manager/edit/' . urlencode($path), 'Edit ' . $path, 'fa fa-edit', $found_in[$path]);
}
$body['<b>' . $name . '</b>'] = implode(' ', $links);
}
return html()->simple_table($body, ['condensed' => 1]);
}
示例15: niceClass
public static function niceClass($tag = "test")
{
if (substr($tag, 0, 1) + 0 > 0) {
$tag = "_number_" . $tag;
}
return html(str_replace(array(" ", "&"), array("_", "_-amp-_"), $tag));
}