本文整理汇总了PHP中tag函数的典型用法代码示例。如果您正苦于以下问题:PHP tag函数的具体用法?PHP tag怎么用?PHP tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login()
{
//记录登陆失败者IP
$ip = get_client_ip();
$username = I("post.account", "", "trim");
$password = I("post.password", "", "trim");
if (empty($username)) {
$this->error("用户名不能为空,请重新输入!");
}
if (empty($password)) {
$this->error("密码不能为空,请重新输入!");
}
if (Admin::getInstance()->login($username, $password)) {
$forward = cookie("forward");
if (!$forward) {
$forward = U("Admins:Index");
} else {
cookie("forward", NULL);
}
//增加登陆成功行为调用
$admin_public_tologin = array('username' => $username, 'ip' => $ip);
tag('admin_public_tologin', $admin_public_tologin);
$this->success('成功登录后台管理系统', U('Index/index'));
} else {
//增加登陆失败行为调用
$admin_public_tologin = array('username' => $username, 'password' => $password, 'ip' => $ip);
tag('admin_public_tologin_error', $admin_public_tologin);
$this->error("用户名或者密码错误,登陆失败!", U("login"));
}
}
示例2: doLoginForm
/**
* Renders and outputs a login form.
*
* This function outputs a full HTML document,
* including <head> and footer.
*
* @param string|array $message The activity message
*/
function doLoginForm($message)
{
global $textarray_script, $event, $step;
include txpath . '/lib/txplib_head.php';
$event = 'login';
if (gps('logout')) {
$step = 'logout';
} elseif (gps('reset')) {
$step = 'reset';
}
pagetop(gTxt('login'), $message);
$stay = (cs('txp_login') and !gps('logout') ? 1 : 0);
$reset = gps('reset');
$name = join(',', array_slice(explode(',', cs('txp_login')), 0, -1));
$out = array();
if ($reset) {
$out[] = hed(gTxt('password_reset'), 2, array('id' => 'txp-login-heading')) . graf(n . span(tag(gTxt('name'), 'label', array('for' => 'login_name')), array('class' => 'txp-label')) . n . span(fInput('text', 'p_userid', $name, '', '', '', INPUT_REGULAR, '', 'login_name'), array('class' => 'txp-value')), ' class="login-name"') . graf(fInput('submit', '', gTxt('password_reset_button'), 'publish') . n) . graf(href(gTxt('back_to_login'), 'index.php'), array('class' => 'login-return')) . hInput('p_reset', 1);
} else {
$out[] = hed(gTxt('login_to_textpattern'), 2, array('id' => 'txp-login-heading')) . graf(n . span(tag(gTxt('name'), 'label', array('for' => 'login_name')), array('class' => 'txp-label')) . n . span(fInput('text', 'p_userid', $name, '', '', '', INPUT_REGULAR, '', 'login_name'), array('class' => 'txp-value')), array('class' => 'login-name')) . graf(n . span(tag(gTxt('password'), 'label', array('for' => 'login_password')), array('class' => 'txp-label')) . n . span(fInput('password', 'p_password', '', '', '', '', INPUT_REGULAR, '', 'login_password'), array('class' => 'txp-value')), array('class' => 'login-password')) . graf(checkbox('stay', 1, $stay, '', 'login_stay') . n . tag(gTxt('stay_logged_in'), 'label', array('for' => 'login_stay')) . popHelp('remember_login') . n, array('class' => 'login-stay')) . graf(fInput('submit', '', gTxt('log_in_button'), 'publish') . n) . graf(href(gTxt('password_forgotten'), '?reset=1'), array('class' => 'login-forgot'));
if (gps('event')) {
$out[] = eInput(gps('event'));
}
}
echo form(tag(join('', $out), 'section', array('role' => 'region', 'class' => 'txp-login', 'aria-labelledby' => 'txp-login-heading')), '', '', 'post', '', '', 'login_form') . script_js('textpattern.textarray = ' . json_encode($textarray_script)) . n . '</main><!-- /txp-body -->' . n . '</body>' . n . '</html>';
exit(0);
}
示例3: get_config_by_app
public function get_config_by_app($app)
{
$config = array();
if ($app && AppService::is_app_active($app)) {
$configs = S("configs/app/all");
$config = $configs[$app];
}
$config = $config ? $config : array();
/*
* 全局文件加载
* **/
foreach (AppService::$allAppConfigs as $app => $app_config) {
if ($app_config['global_include'] && AppService::is_app_active($app)) {
$config['include'] = array_merge_recursive((array) $config['include'], (array) $app_config['global_include']);
}
if ($app_config['force_global_include']) {
$config['include'] = array_merge_recursive((array) $config['include'], (array) $app_config['force_global_include']);
}
if ($app_config['global_load_modules'] && AppService::is_app_active($app)) {
$config['load_modules'] = array_merge_recursive((array) $config['load_modules'], (array) $app_config['global_load_modules']);
}
}
tag("before_app_config_response", $config);
return $config;
}
示例4: authenticate
public function authenticate($company_sign_id, $login, $password)
{
$company = D("Account/Company")->where(array('sign_id' => $company_sign_id))->find();
if (!$company) {
return -1;
}
$user = $this->where(array("company_id" => $company['id'], "login" => $login))->relation(false)->find();
if (!$user) {
return -2;
}
$hashed = $this->generate_password($password, $user['rand_hash']);
if ($user['password'] !== $hashed[0]) {
return -3;
}
$params = array($user, $company);
tag('after_user_authenticated', $params);
list($user, $company) = $params;
session('[destroy]');
session('[start]');
session('[regenerate]');
$is_super_user = false;
if ($company['superuser'] && $company['superuser'] == $user["id"]) {
$is_super_user = true;
}
session('user', array("login" => $user["login"], "id" => $user["id"], "realname" => $user["realname"], "email" => $user["email"], "avatar" => $user["avatar"], "company" => $company, "is_super_user" => $is_super_user));
return true;
}
示例5: text2img
/**
* AlbaToolsHelper.
*
* @package symfony
* @subpackage helper
* @author Fernando Toledo <ftoledo@docksud.com.ar>
* @version SVN: $Id: NumberHelper.php 7757 2008-03-07 10:55:22Z fabien $
*/
function text2img($texto)
{
if (is_null($texto)) {
return null;
}
return tag('img', array('alt' => $texto, 'src' => url_for('albaTools/text2img?texto=' . $texto)));
}
示例6: Syntaxhighlighter_systemCheck
/**
* Returns the requirements information view.
*
* @return string The (X)HTML.
*/
function Syntaxhighlighter_systemCheck()
{
// RELEASE-TODO
global $pth, $tx, $plugin_tx;
define('SYNTAXHIGHLIGHTER_PHP_VERSION', '4.0.7');
$ptx = $plugin_tx['syntaxhighlighter'];
$imgdir = $pth['folder']['plugins'] . 'syntaxhighlighter/images/';
$ok = tag('img src="' . $imgdir . 'ok.png" alt="ok"');
$warn = tag('img src="' . $imgdir . 'warn.png" alt="warning"');
$fail = tag('img src="' . $imgdir . 'fail.png" alt="failure"');
$o = '<h4>' . $ptx['syscheck_title'] . '</h4>' . (version_compare(PHP_VERSION, SYNTAXHIGHLIGHTER_PHP_VERSION) >= 0 ? $ok : $fail) . ' ' . sprintf($ptx['syscheck_phpversion'], SYNTAXHIGHLIGHTER_PHP_VERSION) . tag('br') . "\n";
foreach (array('pcre') as $ext) {
$o .= (extension_loaded($ext) ? $ok : $fail) . ' ' . sprintf($ptx['syscheck_extension'], $ext) . tag('br') . "\n";
}
$o .= (!get_magic_quotes_runtime() ? $ok : $fail) . ' ' . $ptx['syscheck_magic_quotes'] . tag('br') . tag('br') . "\n";
$o .= (strtoupper($tx['meta']['codepage']) == 'UTF-8' ? $ok : $fail) . ' ' . $ptx['syscheck_encoding'] . tag('br') . "\n";
$folders = array();
foreach (array('config/', 'css/', 'languages/') as $folder) {
$folders[] = $pth['folder']['plugins'] . 'syntaxhighlighter/' . $folder;
}
foreach ($folders as $folder) {
$o .= (is_writable($folder) ? $ok : $warn) . ' ' . sprintf($ptx['syscheck_writable'], $folder) . tag('br') . "\n";
}
return $o;
}
示例7: __toString
public function __toString()
{
$name = $this->getPropertyValue('namePattern');
$id = $this->getPropertyValue('namePattern');
$imageHTML = tag('img', array('src' => theme_path('images/callout-left.png'), 'title' => 'Click here to edit', 'alt' => 'Edit', 'class' => 'callout dialogInvoker'));
$placeholderGetters = $this->getPropertyValue('placeholderGetters');
$id = $this->generateAttributeValue($placeholderGetters, $this->getPropertyValue('idPattern'));
$name = $this->generateAttributeValue($placeholderGetters, $this->getPropertyValue('namePattern'));
$comments = $this->getValue();
$commentExtract = '';
$allComments = '';
// show last comment only
if (count($comments) > 0) {
foreach ($comments as $comment) {
$created = new DateTime($comment->getCreated());
$createdAt = set_datepicker_date_format($created->format('Y-m-d')) . ' ' . $created->format('H:i');
$formatComment = $createdAt . ' ' . $comment->getCreatedByName() . "\n\n" . $comment->getComments();
$allComments = $formatComment . "\n\n" . $allComments;
}
$lastComment = $comments->getLast();
$commentExtract = $this->trimComment($lastComment->getComments());
}
$commentContainerHTML = content_tag('span', $commentExtract, array('id' => $this->generateAttributeValue($placeholderGetters, 'commentContainer-{id}')));
$hiddenFieldHTML = tag('input', array('type' => 'hidden', 'id' => $id, 'name' => $name, 'value' => $allComments));
$commentHTML = content_tag('span', $commentContainerHTML . $imageHTML . $hiddenFieldHTML, array('class' => 'commentContainerLong'));
if ($this->isHiddenOnCallback()) {
return ' ';
}
return $commentHTML . $this->getHiddenFieldHTML();
}
示例8: jmd_save
/**
* Inserts JS.
*/
function jmd_save()
{
$js = <<<EOD
//inc <save.js>
EOD;
echo tag($js, 'script', ' type="text/javascript"');
}
示例9: read
public function read()
{
if (!$_GET["includeRows"] or $_GET['workflow']) {
return parent::read();
}
// $this->readModel = "PurchaseView";
// $formData = parent::read(true);
$formData = D("PurchaseView")->find($_GET['id']);
$formData["inputTime"] = $formData["dateline"] * 1000;
// $formData["total_amount"] = $formData["total_price"];
// $formData["total_amount_real"] = $formData["total_price_real"];
// $formData["total_num"] = $formData["quantity"];
$rowModel = D("PurchaseDetailView");
$rows = $rowModel->where("PurchaseDetail.purchase_id=" . $formData["id"])->select();
// echo $rowModel->getLastSql();exit;
$modelIds = array();
$rowData = array();
foreach ($rows as $v) {
$tmp = explode(DBC("goods.unique.separator"), $v["factory_code_all"]);
//根据factory_code_all factory_code - standard - version
$factory_code = array_shift($tmp);
$modelIds = array_merge($modelIds, $tmp);
$v["modelIds"] = $tmp;
$v["goods_id"] = sprintf("%s_%s_%s", $factory_code, $v["goods_id"], $v["goods_category_id"]);
// factory_code, id, catid
$v["goods_id_label"] = sprintf("%s", $v["goods_name"]);
// $v["amount"] = $v["price"];
$rowData[$v["id"]] = $v;
}
// array_flip(array_flip($modelIds));
$formData["customer_id_label"] = $formData["customer"];
$params = array($rowData, $modelIds);
tag("assign_dataModel_data", $params);
$formData["rows"] = reIndex($params[0]);
/*
* 相关单据
* **/
$relateItem = array();
$id = abs(intval($_GET["id"]));
if (isAppLoaded("store")) {
$tmp = D("Stockin")->toRelatedItem("Purchase", $id);
if ($tmp) {
$relateItem = array_merge($relateItem, $tmp);
}
}
if (isAppLoaded("finance")) {
$tmp = D("FinancePayPlan")->toRelatedItem("Purchase", $id);
if ($tmp) {
$relateItem = array_merge($relateItem, $tmp);
}
}
if ($formData["source_model"] == "ProducePlan" && $formData["source_id"] && isAppLoaded("produce")) {
$tmp = D("ProducePlan")->getRelatedItem($formData["source_id"]);
if ($tmp) {
$relateItem[] = $tmp;
}
}
$formData["relatedItems"] = $relateItem;
$this->response($formData);
}
示例10: occurrence_delete
function occurrence_delete()
{
global $vars, $phpcdb, $phpcid, $phpc_script;
$html = tag('div', attributes('class="phpc-container"'));
if (empty($vars["oid"])) {
$message = __('No occurrence selected.');
$html->add(tag('p', $message));
return $html;
}
if (is_array($vars["oid"])) {
$oids = $vars["oid"];
} else {
$oids = array($vars["oid"]);
}
$removed_occurs = array();
$unremoved_occurs = array();
$permission_denied = array();
foreach ($oids as $oid) {
$occur = $phpcdb->get_occurrence_by_oid($oid);
if (!$occur->can_modify()) {
$permission_denied[] = $oid;
} else {
if ($phpcdb->delete_occurrence($oid)) {
$removed_occurs[] = $oid;
// TODO: Verify that the event still has occurences.
$eid = $occur->get_eid();
} else {
$unremoved_occurs[] = $oid;
}
}
}
if (sizeof($removed_occurs) > 0) {
if (sizeof($removed_occurs) == 1) {
$text = __("Removed occurrence");
} else {
$text = __("Removed occurrences");
}
$text .= ': ' . implode(', ', $removed_occurs);
$html->add(tag('p', $text));
}
if (sizeof($unremoved_occurs) > 0) {
if (sizeof($unremoved_occurs) == 1) {
$text = __("Could not remove occurrence");
} else {
$text = __("Could not remove occurrences");
}
$text .= ': ' . implode(', ', $unremoved_occurs);
$html->add(tag('p', $text));
}
if (sizeof($permission_denied) > 0) {
if (sizeof($permission_denied) == 1) {
$text = __("You do not have permission to remove the occurrence.");
} else {
$text = __("You do not have permission to remove occurrences.");
}
$text .= ': ' . implode(', ', $permission_denied);
$html->add(tag('p', $text));
}
return message_redirect($html, "{$phpc_script}?action=display_event&phpcid={$phpcid}&eid={$eid}");
}
示例11: header
function header()
{
$out[] = '<table id="pagetop" cellpadding="0" cellspacing="0">' . n . '<tr id="branding"><td><h1 id="textpattern">Textpattern</h1></td><td id="navpop">' . navPop(1) . '</td></tr>' . n . '<tr id="nav-primary"><td align="center" class="tabs" colspan="2">';
if (!$this->is_popup) {
$out[] = '<table cellpadding="0" cellspacing="0" align="center">' . n . '<tr><td id="messagepane"> ' . $this->announce($this->message) . '</td>';
$secondary = '';
foreach ($this->menu as $tab) {
$tc = $tab['active'] ? 'tabup' : 'tabdown';
$atts = ' class="' . $tc . '"';
$hatts = ' href="?event=' . $tab['event'] . '" class="plain"';
$out[] = tda(tag($tab['label'], 'a', $hatts), $atts);
if ($tab['active'] && !empty($tab['items'])) {
$secondary = '</td></tr><tr id="nav-secondary"><td align="center" class="tabs" colspan="2">' . n . '<table cellpadding="0" cellspacing="0" align="center">' . n . '<tr>';
foreach ($tab['items'] as $item) {
$tc = $item['active'] ? 'tabup' : 'tabdown2';
$secondary .= '<td class="' . $tc . '"><a href="?event=' . $item['event'] . '" class="plain">' . $item['label'] . '</a></td>';
}
$secondary .= '</tr></table>';
}
}
$out[] = '<td id="view-site" class="tabdown"><a href="' . hu . '" class="plain" target="_blank">' . gTxt('tab_view_site') . '</a></td>';
$out[] = '</tr></table>';
$out[] = $secondary;
}
$out[] = '</td></tr></table>';
return join(n, $out);
}
示例12: file_download_list
function file_download_list($atts)
{
global $thisfile;
extract(lAtts(array('break' => br, 'category' => '', 'class' => __FUNCTION__, 'form' => 'files', 'label' => '', 'labeltag' => '', 'limit' => '10', 'offset' => '0', 'sort' => 'filename asc', 'wraptag' => '', 'status' => '4'), $atts));
if (!is_numeric($status)) {
$status = getStatusNum($status);
}
$where = array('1=1');
if ($category) {
$where[] = "category IN ('" . join("','", doSlash(do_list($category))) . "')";
}
if ($status) {
$where[] = "status = '" . doSlash($status) . "'";
}
$qparts = array('order by ' . doSlash($sort), $limit ? 'limit ' . intval($offset) . ', ' . intval($limit) : '');
$rs = safe_rows_start('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', join(' and ', $where) . ' ' . join(' ', $qparts));
if ($rs) {
$out = array();
while ($thisfile = nextRow($rs)) {
$out[] = parse_form($form);
$thisfile = '';
}
if ($out) {
if ($wraptag == 'ul' or $wraptag == 'ol') {
return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}
return $wraptag ? tag(join($break, $out), $wraptag) : join(n, $out);
}
}
return '';
}
示例13: __toString
public function __toString()
{
$label = $this->getPropertyValue('label', $this->identifier);
$id = $this->getId();
$class = $this->getPropertyValue('class', 'plainbtn');
return tag('input', array('type' => $this->getPropertyValue('type', 'button'), 'class' => $class, 'id' => $id, 'name' => $this->getPropertyValue('name', $id), 'onmouseover' => "this.className='{$class} {$class}hov'", 'onmouseout' => "this.className='{$class}'", 'value' => __($label)));
}
示例14: jmd_example
/**
* @name jmd_example
* @description A glorified "Hello, World".
* @author Jon-Michael Deldin
* @author_uri http://jmdeldin.com
* @version 0.1
* @type 0
* @order 5
*/
function jmd_example($attrs, $thing)
{
$js = <<<EOF
//inc <example.js>
EOF;
return tag($js, 'script', ' type="text/javascript"');
}
示例15: thumbnail
function thumbnail($img, $options = array(), $attributes = array())
{
// Maintains Backwards Compatibility - you can pass a string or an array with [profile] set to pull
// from YAML, or you can just pass the options in array format
if (is_array($options)) {
if (isset($options['profile'])) {
$profile = $options['profile'];
unset($options['profile']);
} else {
$profile = '';
}
} else {
$profile = $options;
$options = array();
}
//If a profile is set, pull the profile from YAML. Else, just use the options
//Note: you can override anything set in a profile by passing the overriden argument in options
if ($profile) {
$options = array_merge(getImageCacheProfile($profile), $options);
// You can also set attributes in your imagecache profile
if (isset($options['attributes'])) {
$attributes = array_merge($attributes, $options['attributes']);
}
}
$attributes['src'] = thumbnail_path($img, $options);
return tag('img', $attributes);
}