本文整理汇总了PHP中htmlsafe函数的典型用法代码示例。如果您正苦于以下问题:PHP htmlsafe函数的具体用法?PHP htmlsafe怎么用?PHP htmlsafe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了htmlsafe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_print_if_not_null
function smarty_function_print_if_not_null($params, &$smarty)
{
if ($params['field'] != null) {
$print_if_not_null = "\n <tr>\n <td class='" . htmlsafe($params[class1]) . "'>" . htmlsafe($params[label]) . ":</td>\n\t\t\t\t<td class='" . htmlsafe($params[class2]) . "' colspan='" . htmlsafe($params[colspan]) . "'>" . htmlsafe($params[field]) . "</td>\n </tr>";
echo $print_if_not_null;
}
}
示例2: get_all
public static function get_all()
{
global $dbh;
global $LANG;
global $auth_session;
$customer = null;
$sql = "SELECT * FROM " . TB_PREFIX . "customers WHERE domain_id = :domain_id";
$sth = dbQuery($sql, ':domain_id', $auth_session->domain_id) or die(htmlsafe(end($dbh->errorInfo())));
$customers = null;
for ($i = 0; $customer = $sth->fetch(); $i++) {
if ($customer['enabled'] == 1) {
$customer['enabled'] = $LANG['enabled'];
} else {
$customer['enabled'] = $LANG['disabled'];
}
#invoice total calc - start
$customer['total'] = calc_customer_total($customer['id']);
#invoice total calc - end
#amount paid calc - start
$customer['paid'] = calc_customer_paid($customer['id']);
#amount paid calc - end
#amount owing calc - start
$customer['owing'] = $customer['total'] - $customer['paid'];
#amount owing calc - end
$customers[$i] = $customer;
}
return $customers;
}
示例3: query
function query($sqlQuery)
{
//dbQuery($sql);
try {
//$dbh = $this->connection;
//var_dump($this->_db);
$argc = func_num_args();
$binds = func_get_args();
//$sth = false;
// PDO SQL Preparation
$sth = $this->_db->prepare($sqlQuery);
if ($argc > 1) {
array_shift($binds);
for ($i = 0; $i < count($binds); $i++) {
$sth->bindValue($binds[$i], $binds[++$i]);
}
}
//var_dump($this->_db);
$result = $sth->execute();
//$sth->closeCursor();
if ($sth->errorCode() > '0') {
simpleInvoicesError('sql', $sth->errorInfo(), $sqlQuery);
}
} catch (Exception $e) {
echo $e->getMessage();
echo "Dude, what happened to your query?:<br /><br /> " . htmlsafe($sqlQuery) . "<br />" . htmlsafe(end($this->_db->errorInfo()));
$sth = NULL;
}
//$this->connection->closeCursor();
return $sth;
#return $result;
$sth->closeCursor();
$sth = NULL;
}
示例4: grouped
function grouped($expense_id)
{
$sql = "select \n t.tax_description as tax_name, \n sum(et.tax_amount) as tax_amount,\n count(*) as count\n from \n si_expense_item_tax et, \n si_expense e,\n si_tax t \n where \n e.id = et.expense_id \n AND \n t.tax_id = et.tax_id \n AND\n e.id = :expense_id\n GROUP BY \n t.tax_id;";
$sth = dbQuery($sql, ':expense_id', $expense_id) or die(htmlsafe(end($dbh->errorInfo())));
$result = $sth->fetchAll();
return $result;
}
示例5: update
public function update()
{
global $db;
$sql = "UPDATE ".TB_PREFIX."system_defaults SET value = :value WHERE name = :name";
//dont worry about checking db if were using the core extension
if ( $this->extension_name != "core" )
{
$SI_EXTENSIONS = new SimpleInvoices_Db_Table_Extensions();
$extension_id = $SI_EXTENSIONS->findByName($extension_name);
} else {
$extension_id = 0;
}
if ($extension_id >= 0) {
$sql .= " AND extension_id = :extension_id";
} else {
die(htmlsafe("Invalid extension name: ".$extension));
}
if ($db->query($sql, ':value', $this->value, ':name', $this->name, ':extension_id', $extension_id)) {
return true;
}
return false;
}
示例6: smarty_function_online_payment_link
function smarty_function_online_payment_link($params, &$smarty)
{
global $LANG;
$domain_id = domain_id::get($params['domain_id']);
$url = getURL();
if (in_array("paypal", explode(",", $params['type']))) {
$link = "<a \n\t\t\t\thref=\"https://www.paypal.com/xclick/?business=" . urlencode($params['business']) . "&item_name=" . urlencode($params['item_name']) . "&invoice=" . urlencode($params['invoice']) . "&amount=" . urlencode(number_format($params['amount'], 2, '.', '')) . "¤cy_code=" . urlencode($params['currency_code']) . "¬ify_url=" . urlencode($params['notify_url']) . "&return=" . urlencode($params['return_url']) . "&no_shipping=1&no_note=1&custom=domain_id:" . urlencode($domain_id) . "; \">";
if ($params['include_image'] == "true") {
$link .= "<img border='0' src='" . urlsafe($url) . "/images/common/pay_with_paypal.gif'/>";
} else {
$link .= htmlsafe($params['link_wording']);
}
$link .= "</a>";
echo $link;
}
if (in_array("eway_shared", explode(",", $params['type']))) {
$link = "<a \n\t\t\t\thref=\"https://www.paypal.com/xclick/?business=" . urlencode($params['business'] . "\n\t\t\t\t&item_name=" . urlencode($params['item_name']) . "&invoice=" . urlencode($params['invoice']) . "\n\t\t\t\t&amount=" . urlencode(number_format($params['amount'], 2, '.', '')) . "¤cy_code=" . $params['currency_code']) . "\n\t\t\t\t&return=http://vcsweb.com.au&no_shipping=1&no_note=1\">";
if ($params['include_image'] == "true") {
$link .= "<img border='0' src='" . urlsafe($url) . "/images/common/pay_with_eway.gif'/>";
} else {
$link .= htmlsafe($params['link_wording']);
}
$link .= "</a>";
echo $link;
}
}
示例7: insert
public function insert()
{
global $db;
global $auth_session;
global $dbh;
$domain_id = domain_id::get($this->domain_id);
$sql = "INSERT INTO ".TB_PREFIX."payment_types (
pt_description,
pt_enabled,
domain_id
) VALUES (
:pt_description,
:pt_enabled,
:domain_id
)";
$sth = $db->query($sql,
':pt_description',$this->pt_description,
':pt_enabled',$this->pt_enabled,
':domain_id',$domain_id
) or die(htmlsafe(end($dbh->errorInfo())));
return $sth;
}
示例8: printInputField
function printInputField($id,$itemId) {
$description = $this->getDescription($id);
$name = $this->getFormName($id);
if($itemId != "") {
$value = $this->getFieldValue($id,$itemId);
}
else {
$last = $this->getLastValue();
$year = date("Y");
if(preg_match("/([0-9]+)-([0-9]{4})/",$last,$match)) {
if($year == $match[2]) {
$number = $match[1]+1;
$value = $number."-".$year;
}
else {
$value = "1-".$year;
}
}
else {
$value = "1-".$year;
}
}
echo "<tr><td>".htmlsafe($description)."</td><td><input name='".htmlsafe($name)."' value='".htmlsafe($value)."' type='hidden'>".htmlsafe($value)."</td></tr>";
}
示例9: check
public function check()
{
global $db;
global $dbh;
$domain_id = domain_id::get($this->domain_id);
$run_date = empty($this->run_date) ? $today : $this->run_date;
$sql = "SELECT
count(*) as count
FROM
".TB_PREFIX."cron_log
WHERE
domain_id = :domain_id
AND
cron_id = :cron_id
AND
run_date = :run_date";
$sth = $db->query($sql,
':domain_id',$domain_id,
':cron_id',$this->cron_id,
':run_date',$run_date
) or die(htmlsafe(end($dbh->errorInfo())));
return $sth->fetchColumn();
}
示例10: get
public static function get($id)
{
global $db;
global $auth_session;
global $dbh;
$sql = "SELECT * FROM ".TB_PREFIX."expense WHERE domain_id = :domain_id and id = :id";
/*$sql = "SELECT
*
FROM
".TB_PREFIX."expense e
LEFT OUTER JOIN ".TB_PREFIX."expense_item_tax et
ON (e.id = et.expense_id)
WHERE
e.domain_id = :domain_id
and e.id = :id
";*/
$sth = $db->query($sql,':domain_id',$auth_session->domain_id ,':id',$id) or die(htmlsafe(end($dbh->errorInfo())));
return $sth->fetch();
}
示例11: printInputField
function printInputField($id,$itemId) {
$description = $this->getDescription($id);
$value = rand();
$name = $this->getFormName($id);
echo "<tr><input type='hidden' name='".htmlsafe($name)."' value='".htmlsafe($value)."'><td>".htmlsafe($description).":</td><td>".htmlsafe($value)."</td></tr>";
}
示例12: smarty_function_merge_address
function smarty_function_merge_address($params, &$smarty)
{
global $LANG;
$skip_section = false;
$ma = '';
// If any among city, state or zip is present with no street at all
if (($params['field1'] != null or $params['field2'] != null or $params['field3'] != null) and ($params['street1'] == null and $params['street2'] == null)) {
$ma .= "\n\t\t<tr>\n\t\t\t\t<td class='" . htmlsafe($params[class1]) . "'>{$LANG['address']}:</td>\n\t\t\t\t<td class='" . htmlsafe($params[class2]) . "' colspan='" . htmlsafe($params[colspan]) . "'>";
$skip_section = true;
}
// If any among city, state or zip is present with atleast one street value
if (($params['field1'] != null or $params['field2'] != null or $params['field3'] != null) and !$skip_section) {
$ma .= "\n\t\t<tr>\n\t\t\t\t<td class='" . htmlsafe($params[class1]) . "'></td>\n\t\t\t\t<td class='" . htmlsafe($params[class2]) . "' colspan='" . htmlsafe($params[colspan]) . "'>";
}
if ($params['field1'] != null) {
$ma .= htmlsafe($params[field1]);
}
if ($params['field1'] != null and $params['field2'] != null) {
$ma .= ", ";
}
if ($params['field2'] != null) {
$ma .= htmlsafe($params[field2]);
}
if (($params['field1'] != null or $params['field2'] != null) and $params['field3'] != null) {
$ma .= ", ";
}
if ($params['field3'] != null) {
$ma .= htmlsafe($params[field3]);
}
$ma .= "</td>\n\t\t</tr>";
echo $ma;
}
示例13: getInvoiceItems
function getInvoiceItems($id)
{
$sql = "SELECT * FROM " . TB_PREFIX . "invoice_items WHERE invoice_id = :id";
$sth = dbQuery($sql, ':id', $id);
$invoiceItems = null;
for ($i = 0; $invoiceItem = $sth->fetch(); $i++) {
$invoiceItem['quantity'] = $invoiceItem['quantity'];
$invoiceItem['unit_price'] = $invoiceItem['unit_price'];
$invoiceItem['tax_amount'] = $invoiceItem['tax_amount'];
$invoiceItem['gross_total'] = $invoiceItem['gross_total'];
$invoiceItem['total'] = $invoiceItem['total'];
$sql = "SELECT * FROM " . TB_PREFIX . "products WHERE id = :id";
$tth = dbQuery($sql, ':id', $invoiceItem['product_id']) or die(htmlsafe(end($dbh->errorInfo())));
$invoiceItem['product'] = $tth->fetch();
$attr_sql = "select \r\n CONCAT(a.display_name, '-',v.value) as display,\r\n\t\t\t\t\tCONCAT(p.id, '-', a.id, '-', v.id) as id, \r\n\t\t\t\t\ta.id as aid \r\n from\r\n si_products_attributes a,\r\n si_products_values v,\r\n\t\t\t\t\tsi_products_matrix m,\r\n\t\t\t\t\tsi_products p\r\n where\r\n\t\t\t\t\tp.id = m.product_id \r\n\t\t\t\t\tand \r\n\t\t\t\t\ta.id = m.attribute_id \r\n\t\t\t\t\tand \r\n a.id = v.attribute_id\r\n\t\t\t\t\tand\r\n\t\t\t\t\tp.id = :pid\r\n and\r\n v.id = :attr_id";
$attr_all_sql = "select \r\n CONCAT(a.display_name, '-',v.value) as display,\r\n\t\t\t\t\tCONCAT(p.id, '-', a.id, '-', v.id) as id \r\n\t\t\t\t\r\n from\r\n si_products_attributes a,\r\n si_products_values v,\r\n\t\t\t\t\tsi_products_matrix m,\r\n\t\t\t\t\tsi_products p\r\n where\r\n\t\t\t\t\tp.id = m.product_id \r\n\t\t\t\t\tand \r\n\t\t\t\t\ta.id = m.attribute_id \r\n\t\t\t\t\tand \r\n a.id = v.attribute_id\r\n\t\t\t\t\tand\r\n\t\t\t\t\tp.id = :pid\r\n and\r\n m.attribute_id = :aid\r\n and\r\n v.id != :attr_id";
$attr1 = dbQuery($attr_sql, ':attr_id', $invoiceItem['attribute_1'], ':pid', $invoiceItem['product_id']) or die(htmlsafe(end($dbh->errorInfo())));
$invoiceItem['attr1'] = $attr1->fetch();
$attr_all_1 = dbQuery($attr_all_sql, ':attr_id', $invoiceItem['attribute_1'], ':pid', $invoiceItem['product_id'], ':aid', $invoiceItem['attr1']['aid']) or die(htmlsafe(end($dbh->errorInfo())));
$invoiceItem['attr_all_1'] = $attr_all_1->fetchAll();
$attr2 = dbQuery($attr_sql, ':attr_id', $invoiceItem['attribute_2'], ':pid', $invoiceItem['product_id']) or die(htmlsafe(end($dbh->errorInfo())));
$invoiceItem['attr2'] = $attr2->fetch();
$attr_all_2 = dbQuery($attr_all_sql, ':attr_id', $invoiceItem['attribute_2'], ':pid', $invoiceItem['product_id'], ':aid', $invoiceItem['attr2']['aid']) or die(htmlsafe(end($dbh->errorInfo())));
$invoiceItem['attr_all_2'] = $attr_all_2->fetchAll();
$attr3 = dbQuery($attr_sql, ':attr_id', $invoiceItem['attribute_3'], ':pid', $invoiceItem['product_id']) or die(htmlsafe(end($dbh->errorInfo())));
$invoiceItem['attr3'] = $attr3->fetch();
$attr_all_3 = dbQuery($attr_all_sql, ':attr_id', $invoiceItem['attribute_3'], ':pid', $invoiceItem['product_id'], ':aid', $invoiceItem['attr2']['aid']) or die(htmlsafe(end($dbh->errorInfo())));
$invoiceItem['attr_all_3'] = $attr_all_3->fetchAll();
$invoiceItems[$i] = $invoiceItem;
}
return $invoiceItems;
}
示例14: smarty_function_inv_itemised_cf
function smarty_function_inv_itemised_cf($params, &$smarty)
{
//$print_cf ="testsd";
if ($params['field'] != null) {
$print_cf .= "<td width=50%>".htmlsafe($params[label]).": ".htmlsafe($params[field])."</td>";
echo $print_cf;
}
}
示例15: select
public function select()
{
global $LANG;
global $db;
$sql = "SELECT\n\t\t\t\tiv.*,\n p.description\n\t\t\tFROM \n\t\t\t\t" . TB_PREFIX . "products p,\n\t\t\t\t" . TB_PREFIX . "inventory iv\n\t\t\t WHERE \n\t\t\t\tiv.domain_id = :domain_id\n\t\t\t\tand\n p.id = iv.product_id\n\t\t\t\tand\n iv.id = :id;";
$sth = $db->query($sql, ':domain_id', domain_id::get($this->domain_id), ':id', $this->id) or die(htmlsafe(end($dbh->errorInfo())));
return $sth->fetch();
}