本文整理汇总了PHP中Html类的典型用法代码示例。如果您正苦于以下问题:PHP Html类的具体用法?PHP Html怎么用?PHP Html使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Html类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFilter
public function testFilter()
{
$filter = new Html();
$this->assertEquals('<a>test</a>', $filter->apply('<a>test</a>'));
$this->assertEquals('test', $filter->apply('test'));
// test error message
$this->assertErrorMessage($filter->getErrorMessage());
}
示例2: displayTabContentForItem
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
echo "<form name='notificationtargets_form' id='notificationtargets_form'\n method='post' action=' ";
echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class ='tab_cadre_fixe'>";
echo '<tr><th colspan="2">' . __('Access type', 'formcreator') . '</th></tr>';
echo '<td>' . __('Access', 'formcreator') . '</td>';
echo '<td>';
Dropdown::showFromArray('access_rights', array(PluginFormcreatorForm::ACCESS_PUBLIC => __('Public access', 'formcreator'), PluginFormcreatorForm::ACCESS_PRIVATE => __('Private access', 'formcreator'), PluginFormcreatorForm::ACCESS_RESTRICTED => __('Restricted access', 'formcreator')), array('value' => isset($item->fields["access_rights"]) ? $item->fields["access_rights"] : 1));
echo '</td>';
if ($item->fields["access_rights"] == PluginFormcreatorForm::ACCESS_RESTRICTED) {
echo '<tr><th colspan="2">' . self::getTypeName(2) . '</th></tr>';
$table = getTableForItemType(__CLASS__);
$table_profile = getTableForItemType('Profile');
$query = "SELECT p.`id`, p.`name`, IF(f.`plugin_formcreator_profiles_id` IS NOT NULL, 1, 0) AS `profile`\n FROM {$table_profile} p\n LEFT JOIN {$table} f\n ON p.`id` = f.`plugin_formcreator_profiles_id`\n AND f.`plugin_formcreator_forms_id` = " . (int) $item->fields['id'];
$result = $GLOBALS['DB']->query($query);
while (list($id, $name, $profile) = $GLOBALS['DB']->fetch_array($result)) {
$checked = $profile ? ' checked' : '';
echo '<tr><td colspan="2"><label>';
echo '<input type="checkbox" name="profiles_id[]" value="' . $id . '" ' . $checked . '> ';
echo $name;
echo '</label></td></tr>';
}
}
echo '<tr>';
echo '<td class="center" colspan="2">';
echo '<input type="hidden" name="profiles_id[]" value="0" />';
echo '<input type="hidden" name="form_id" value="' . (int) $item->fields['id'] . '" />';
echo '<input type="submit" name="update" value="' . __('Save') . '" class="submit" />';
echo "</td>";
echo "</tr>";
echo "</table>";
Html::closeForm();
}
示例3: check
public function check()
{
$username = $_POST['username'];
$password = $_POST['password'];
$conn = Db::getConnection();
$sql = "SELECT username, password, admin\n\t\t\t\tFROM users\n\t\t\t\tWHERE username = '{$username}'";
$q = $conn->prepare($sql);
$q->execute();
$users = $q->fetch(\PDO::FETCH_ASSOC);
//var_dump($users);die(' proba');
$logger = new Logger();
$error = $logger->checkCredentials($password, $users);
//$isAdmin = $logger->checkAdmin($password,$users);
//var_dump($error);die(' ajde vise!!!');
if ($error) {
//echo '<pre>'; var_dump($error);die(); echo '</pre>';
$html = new Html($this->controllerName);
$html->error = $error;
//echo '<pre>'; var_dump($html->error);die(); echo '</pre>';
$html->render('index');
} else {
$user = new User($users['username'], $users['admin']);
$user->login();
//var_dump($user);die(' jebem li ga');
header('Location: /');
}
}
示例4: testSetGetStorageAsText
/**
* Test that the storage number can be set and retrieved.
*/
public function testSetGetStorageAsText()
{
$text = 'test';
$html = new Html();
$html->set('test', $text);
$this->assertSame($text, $html->get('test'));
}
示例5: tagField
function tagField($db, $limit = null)
{
$nsid = $_SESSION['namespace_id'] ? $_SESSION['namespace_id'] : DB_PUBNS;
$sql = sprintf('select t.name, m.tag, count(m.tag) as num from tagmap as ' . 'm, tags as t where t.id=m.tag and t.namespace=%d group by tag ' . 'order by date desc', $nsid);
$sql .= !is_null($limit) ? ' LIMIT ' . $limit : null;
$max_size = 250;
$min_size = 100;
if (!($result = $db->query($sql))) {
debug_hook('Failed to load tag cloud!', __METHOD__);
return;
}
while ($row = $result->fetch_assoc()) {
$tags[$row['name']] = $row['num'];
}
$max_value = max(array_values($tags));
$min_value = min(array_values($tags));
$spread = $max_value - $min_value;
if ($spread == 0) {
$spread = 1;
}
$step = ($max_size - $min_size) / $spread;
print '<div id="tags">';
foreach ($tags as $key => $value) {
$size = ceil($min_size + ($value - $min_value) * $step);
$a = new Html('a');
$a->attr('style', 'font-size: ' . $size . '%');
$a->attr('href', DB_LOC . '/tags/' . urlencode($key));
$a->data(str_replace('_', ' ', $key));
$a->write();
print '(' . $value . '), ';
}
print '<a href="' . DB_LOC . '/">all</a>';
print '</div>';
}
示例6: add
public function add($data)
{
$ContentModel = ContentModel::getInstance($this->_mid);
if (!isset($this->_model[$this->_mid])) {
$this->error = '模型不存在';
}
$ContentInputModel = new ContentInputModel($this->_mid);
$insertData = $ContentInputModel->get($data);
if ($insertData == false) {
$this->error = $ContentInputModel->error;
return false;
}
if ($ContentModel->create($insertData)) {
$result = $ContentModel->add($insertData);
$aid = $result[$ContentModel->table];
$this->editTagData($aid);
M('upload')->where(array('uid' => $_SESSION['uid']))->save(array('state' => 1));
//============记录动态
$DMessage = "发表了文章:<a target='_blank' href='" . U('Index/Index/content', array('mid' => $insertData['mid'], 'cid' => $insertData['cid'], 'aid' => $aid)) . "'>{$insertData['title']}</a>";
addDynamic($_SESSION['uid'], $DMessage);
//内容静态
$Html = new Html();
$Html->content($this->find($aid));
$categoryCache = cache('category');
$cat = $categoryCache[$insertData['cid']];
$Html->relation_category($insertData['cid']);
$Html->index();
return $aid;
} else {
$this->error = $ContentModel->error;
return false;
}
}
示例7: create
public function create()
{
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = password_hash($_POST['password'], PASSWORD_BCRYPT);
$conn = Db::getConnection();
$sql = "SELECT *\n\t\t\t\tFROM users";
$q = $conn->prepare($sql);
$q->execute();
$users = $q->fetchAll(\PDO::FETCH_ASSOC);
$validator = new Validator();
$error = $validator->validateRegisterForm($_POST, $users);
//echo '<pre>'; var_dump($error); echo '</pre>';die();
if ($error) {
//echo '<pre>'; var_dump($error);die(); echo '</pre>';
$html = new Html($this->controllerName);
$html->error = $error;
//echo '<pre>'; var_dump($html->error);die(); echo '</pre>';
//;kweojn'dlfv'dlfkv
$html->render('index');
} else {
$newUserSql = "INSERT INTO users\n\t\t\t(`firstname`, `lastname`, `email`, `username`, `password`, `admin`)\n\t\t\tVALUES\n\t\t\t('{$firstname}', '{$lastname}', '{$email}', '{$username}', '{$password}', '0')";
$q = $conn->prepare($newUserSql);
$q->execute();
header('Location: /login/index');
}
}
示例8: placeLink
public function placeLink(Html $row, DibiRow $data, $pres)
{
foreach ($row->getChildren() as $cell) {
$inside = $cell->getText();
$cell->setText('');
$cell->add(Html::el('a')->href($this->link(":Front:{$pres}:", $data['link']))->setText($inside));
}
}
示例9: _before_add
function _before_add()
{
$html = new Html();
$fields_type = $this->_mod->site_model_fields();
$this->assign('fields_type', $html->select($fields_type, 'formtype'));
$regexp = $this->_mod->regexp();
$this->assign('verification_select', $html->select($regexp, 'verification_select', '', 'id="J_verification_select" style="width:100px"'));
}
示例10: getPreAuthPage
private function getPreAuthPage()
{
$mainTag = new Html();
$head = new Head();
$head->addChild("\n <title>Admin page</title>\n <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n <link rel='shortcut icon' href='images/system/favicon.ico' type='image/x-icon'/>\n <link rel='stylesheet' type='text/css' href='/src/front/style/style-less.css'/>\n <script type='text/javascript' src='/src/front/js/fixies.js'></script>\n <script type='text/javascript' src='/src/front/js/ext/jquery.js'></script>\n <script type='text/javascript' src='/src/front/js/ext/jquery-1.10.2.js'></script>\n <script type='text/javascript' src='/src/front/js/ext/tinycolor.js'></script>\n <script type='text/javascript' src='/src/front/js/v-utils.js'></script>\n <script type='text/javascript' src='/src/front/js/utils.js'></script>\n <script type='text/javascript' src='/src/front/js/admin.js'></script>\n <script type='text/javascript' src='/src/front/js/components/vCore-effects.js'></script>\n ");
$body = new Body();
$body->addChild("\n <div class='admin_auth_container' >\n <div class='auth_header f-20'>Авторизация</div>\n <label class='f-15' for='user'>User</label>\n <input id='user'>\n <label class='f-15' for='password'>Password</label>\n <input id='password' type='password'>\n <button class='button f-20 input_hover'>Войти</button>\n </div>\n <script type='text/javascript'>\n /*inputHoverModule.update();*/\n </script>\n ");
return $mainTag->addChildList([$head, $body]);
}
示例11: deploy
public function deploy($element, $flag, $alias = '', $view = '', $schema = '')
{
$h = new Html();
if ($flag == 0) {
$attr = '{"id":"' . $alias . '-' . $view . '"}';
$h->b($element, 0, 1, $schema, $attr);
} else {
$h->b($element, 1, 1);
}
}
示例12: getHtml
public function getHtml()
{
$html = new Html();
$head = new Head();
$head->addChild("\n <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n <meta http-equiv='cache-control' content='max-age=0' />\n <meta http-equiv='cache-control' content='no-cache' />\n <meta http-equiv='expires' content='0' />\n <meta http-equiv='expires' content='Tue, 01 Jan 1980 1:00:00 GMT' />\n <meta http-equiv='pragma' content='no-cache' />\n <link rel='stylesheet' type='text/css' href='/src/front/style/admin-page.css'>\n ");
$head->addChild(Components::getMenu());
$head->addChildList($this->getHeadContent());
$body = new Body();
$body->addChildList($this->getGeneralContent());
return $this->pagePrefix . $html->addChildList([$head, $body])->getHtml();
}
示例13: _before_edit
function _before_edit()
{
$html = new Html();
$advertising_list = $this->get_advertising();
$input_data = join(',', $advertising_list);
$selected = $this->_mod->where(array('id' => $this->_get('id')))->getField('advertising');
$advertising = $html->input('select', 'advertising', $input_data, 'advertising', '', $selected);
$this->assign('advertising', $advertising);
//广告位
$this->assign('iframe_tools', true);
//iFrame弹窗
}
示例14: testInterpret
public function testInterpret()
{
/** @var \Magento\Framework\View\Layout\Reader\Context $readerContext */
$readerContext = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\View\\Layout\\Reader\\Context');
$pageXml = new \Magento\Framework\View\Layout\Element(__DIR__ . '/_files/_layout_update.xml', 0, true);
$parentElement = new \Magento\Framework\View\Layout\Element('<page></page>');
$html = new Html();
foreach ($pageXml->xpath('html') as $htmlElement) {
$html->interpret($readerContext, $htmlElement, $parentElement);
}
$structure = $readerContext->getPageConfigStructure();
$this->assertEquals(['html' => ['test-name' => 'test-value']], $structure->getElementAttributes());
}
示例15: index
public function index()
{
$conn = Db::getConnection();
$articleModel = new Article();
$firstFiveArticles = $articleModel->getArticles($conn, 5);
//var_dump($firstFiveArticles);die('lele');
foreach ($firstFiveArticles as &$article) {
$article['time'] = $articleModel->formatArticleDate($article["time"]);
//date("d.m.Y H:i",strtotime($article["time"]))
}
$html = new Html($this->controllerName);
$html->firstFiveArticles = $firstFiveArticles;
$html->render('home');
//var_dump($result);die();
}