本文整理汇总了PHP中permlinkurl_id函数的典型用法代码示例。如果您正苦于以下问题:PHP permlinkurl_id函数的具体用法?PHP permlinkurl_id怎么用?PHP permlinkurl_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了permlinkurl_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tc_shopping_cart_detail
function tc_shopping_cart_detail($atts)
{
session_start();
extract(lAtts(array('checkout_section' => 'checkout'), $atts));
$cart = $_SESSION['cart'];
if (empty($cart)) {
$cart = new bckCart();
}
if (isset($_REQUEST['empty_cart'])) {
$cart->empty_cart();
$_SESSION['cart'] = $cart;
}
$cartHTML = startTable("shopping_cart") . tr(n . hCell("Item") . n . hCell("Quantity") . n . hCell("Price") . n . hCell("Subtotal"));
foreach ($cart->items as $product) {
$image = '<img src="' . product_image_display($product['image'], "small") . '" alt="Product Detail" class="thumb"/>';
$link = "<a href='" . permlinkurl_id($product['ID']) . "' title='View product detail'>" . $product['name'] . "</a>";
$cartHTML .= tr(n . td($image . $link) . n . td($product['qty']) . n . td(_tc_price_format($product['price'])) . n . td(_tc_price_format($product['price'])));
}
$cartHTML .= endTable();
$cartHTML .= tag(tag(tag("Empty Cart", "a", " href='?empty_cart=true' class='cartAction' id='emptyCart'"), "li") . tag(tag("Continue Shopping", "a", " href='#' class='cartAction' id='continueShopping'"), "li") . tag(tag("Checkout", "a", " href='/{$checkout_section}/' class='cartAction' id='checkout'"), "li") . tag(tag(_tc_price_format($cart->total), "span", " class='cartTotal'"), "li"), "ul");
return $cartHTML;
}
示例2: article_edit
function article_edit($message = '', $concurrent = FALSE)
{
global $vars, $txp_user, $comments_disabled_after, $txpcfg, $prefs;
extract($prefs);
extract(gpsa(array('view', 'from_view', 'step')));
if (!empty($GLOBALS['ID'])) {
// newly-saved article
$ID = $GLOBALS['ID'];
$step = 'edit';
} else {
$ID = gps('ID');
}
include_once txpath . '/lib/classTextile.php';
$textile = new Textile();
// switch to 'text' view upon page load and after article post
if (!$view || gps('save') || gps('publish')) {
$view = 'text';
}
if (!$step) {
$step = "create";
}
if ($step == "edit" && $view == "text" && !empty($ID) && $from_view != 'preview' && $from_view != 'html' && !$concurrent) {
$pull = true;
//-- it's an existing article - off we go to the db
$ID = assert_int($ID);
$rs = safe_row("*, unix_timestamp(Posted) as sPosted,\n\t\t\t\tunix_timestamp(Expires) as sExpires,\n\t\t\t\tunix_timestamp(LastMod) as sLastMod", "textpattern", "ID={$ID}");
extract($rs);
$reset_time = $publish_now = $Status < 4;
} else {
$pull = false;
//-- assume they came from post
if ($from_view == 'preview' or $from_view == 'html') {
$store_out = array();
$store = unserialize(base64_decode(ps('store')));
foreach ($vars as $var) {
if (isset($store[$var])) {
$store_out[$var] = $store[$var];
}
}
} else {
$store_out = gpsa($vars);
if ($concurrent) {
$store_out['sLastMod'] = safe_field('unix_timestamp(LastMod) as sLastMod', 'textpattern', 'ID=' . $ID);
}
}
extract($store_out);
}
$GLOBALS['step'] = $step;
if ($step == 'create') {
$textile_body = $use_textile;
$textile_excerpt = $use_textile;
}
if ($step != 'create') {
// Previous record?
$prev_id = checkIfNeighbour('prev', $sPosted);
// Next record?
$next_id = checkIfNeighbour('next', $sPosted);
}
$page_title = $Title ? $Title : gTxt('write');
pagetop($page_title, $message);
echo n . n . '<form name="article" method="post" action="index.php">';
if (!empty($store_out)) {
echo hInput('store', base64_encode(serialize($store_out)));
}
echo hInput('ID', $ID) . eInput('article') . sInput($step) . '<input type="hidden" name="view" />' . startTable('edit') . '<tr>' . n . '<td id="article-col-1">';
if ($view == 'text') {
//-- markup help --------------
echo side_help($textile_body, $textile_excerpt) . '<h3 class="plain"><a href="#advanced" onclick="toggleDisplay(\'advanced\'); return false;">' . gTxt('advanced_options') . '</a></h3>', '<div id="advanced" class="toggle" style="display:none">', n . graf('<label for="markup-body">' . gTxt('article_markup') . '</label>' . br . pref_text('textile_body', $textile_body, 'markup-body')), n . graf('<label for="markup-excerpt">' . gTxt('excerpt_markup') . '</label>' . br . pref_text('textile_excerpt', $textile_excerpt, 'markup-excerpt')), $allow_form_override ? graf('<label for="override-form">' . gTxt('override_default_form') . '</label>' . sp . popHelp('override_form') . br . form_pop($override_form, 'override-form')) : '', $custom_1_set ? custField(1, $custom_1_set, $custom_1) : '', $custom_2_set ? custField(2, $custom_2_set, $custom_2) : '', $custom_3_set ? custField(3, $custom_3_set, $custom_3) : '', $custom_4_set ? custField(4, $custom_4_set, $custom_4) : '', $custom_5_set ? custField(5, $custom_5_set, $custom_5) : '', $custom_6_set ? custField(6, $custom_6_set, $custom_6) : '', $custom_7_set ? custField(7, $custom_7_set, $custom_7) : '', $custom_8_set ? custField(8, $custom_8_set, $custom_8) : '', $custom_9_set ? custField(9, $custom_9_set, $custom_9) : '', $custom_10_set ? custField(10, $custom_10_set, $custom_10) : '', n . graf('<label for="keywords">' . gTxt('keywords') . '</label>' . sp . popHelp('keywords') . br . n . '<textarea id="keywords" name="Keywords" cols="18" rows="5">' . htmlspecialchars(str_replace(',', ', ', $Keywords)) . '</textarea>'), n . graf('<label for="article-image">' . gTxt('article_image') . '</label>' . sp . popHelp('article_image') . br . fInput('text', 'Image', $Image, 'edit', '', '', 22, '', 'article-image')), n . graf('<label for="url-title">' . gTxt('url_title') . '</label>' . sp . popHelp('url_title') . br . fInput('text', 'url_title', $url_title, 'edit', '', '', 22, '', 'url-title')), '</div>
<h3 class="plain"><a href="#recent" onclick="toggleDisplay(\'recent\'); return false;">' . gTxt('recent_articles') . '</a>' . '</h3>' . '<div id="recent" class="toggle" style="display:none">';
$recents = safe_rows_start("Title, ID", 'textpattern', "1=1 order by LastMod desc limit 10");
if ($recents) {
echo '<ul class="plain-list">';
while ($recent = nextRow($recents)) {
if (!$recent['Title']) {
$recent['Title'] = gTxt('untitled') . sp . $recent['ID'];
}
echo n . t . '<li><a href="?event=article' . a . 'step=edit' . a . 'ID=' . $recent['ID'] . '">' . escape_title($recent['Title']) . '</a></li>';
}
echo '</ul>';
}
echo '</div>';
} else {
echo sp;
}
echo '</td>' . n . '<td id="article-main">';
//-- title input --------------
if ($view == 'preview') {
echo hed(gTxt('preview'), 2) . hed($Title, 1);
} elseif ($view == 'html') {
echo hed('XHTML', 2) . hed($Title, 1);
} elseif ($view == 'text') {
echo n . '<p><label for="title">' . gTxt('title') . '</label>' . sp . popHelp('title') . br . '<input type="text" id="title" name="Title" value="' . escape_title($Title) . '" class="edit" size="40" tabindex="1" />';
if ($step != 'create') {
include_once txpath . '/publish/taghandlers.php';
$url = permlinkurl_id($ID);
if ($Status != 4 and $Status != 5) {
$url .= (strpos($url, '?') === FALSE ? '?' : '&') . 'txpreview=' . intval($ID) . '.' . time();
}
echo sp . sp . '<a href="' . $url . '" class="article-view">' . gTxt('view') . '</a>';
//.........这里部分代码省略.........
示例3: mail_comment
function mail_comment($message, $cname, $cemail, $cweb, $parentid, $discussid)
{
global $sitename;
$parentid = assert_int($parentid);
$discussid = assert_int($discussid);
$article = safe_row("Section, Posted, ID, url_title, AuthorID, Title", "textpattern", "ID = {$parentid}");
extract($article);
extract(safe_row("RealName, email", "txp_users", "name = '" . doSlash($AuthorID) . "'"));
$evaluator =& get_comment_evaluator();
$out = gTxt('greeting') . " {$RealName}," . n . n;
$out .= str_replace('{title}', $Title, gTxt('comment_recorded')) . n;
$out .= permlinkurl_id($parentid) . n;
if (has_privs('discuss', $AuthorID)) {
$out .= hu . 'textpattern/index.php?event=discuss&step=discuss_edit&discussid=' . $discussid . n;
}
$out .= gTxt('status') . ": " . $evaluator->get_result('text') . '. ' . implode(',', $evaluator->get_result_message()) . n;
$out .= n;
$out .= gTxt('comment_name') . ": {$cname}" . n;
$out .= gTxt('comment_email') . ": {$cemail}" . n;
$out .= gTxt('comment_web') . ": {$cweb}" . n;
$out .= gTxt('comment_comment') . ": {$message}";
$subject = strtr(gTxt('comment_received'), array('{site}' => $sitename, '{title}' => $Title));
$success = txpMail($email, $subject, $out, $cemail);
}
示例4: formatCommentsInvite
function formatCommentsInvite($AnnotateInvite, $Section, $ID)
{
global $comments_mode;
$dc = safe_count('txp_discuss', "parentid='{$ID}' and visible=1");
$ccount = $dc ? '[' . $dc . ']' : '';
if (!$comments_mode) {
return '<a href="' . permlinkurl_id($ID) . '/#' . gTxt('comment') . '">' . $AnnotateInvite . '</a>' . $ccount;
} else {
return "<a href=\"" . hu . "?parentid={$ID}\" onclick=\"window.open(this.href, 'popupwindow', 'width=500,height=500,scrollbars,resizable,status'); return false;\">" . $AnnotateInvite . '</a> ' . $ccount;
}
}
示例5: article_partial_article_view
/**
* Renders article 'view' link.
*
* @param array $rs Article data
* @return string HTML
*/
function article_partial_article_view($rs)
{
extract($rs);
if ($Status != STATUS_LIVE and $Status != STATUS_STICKY) {
$url = '?txpreview=' . intval($ID) . '.' . time();
// Article ID plus cachebuster.
} else {
include_once txpath . '/publish/taghandlers.php';
$url = permlinkurl_id($ID);
}
return n . href('<span class="ui-icon ui-icon-notice"></span> ' . gTxt('view'), $url, array('class' => 'txp-article-view', 'id' => 'article_partial_article_view'));
}
示例6: update
/**
* Hooks to article saving process and updates short URLs
*/
public static function update()
{
global $prefs;
if (empty($prefs['rah_bitly_login']) || empty($prefs['rah_bitly_apikey']) || empty($prefs['rah_bitly_field'])) {
return;
}
static $old = array();
static $updated = false;
$id = !empty($GLOBALS['ID']) ? $GLOBALS['ID'] : ps('ID');
if (!$id || ps('_txp_token') != form_token() || intval(ps('Status')) < 4) {
$old = array('permlink' => NULL, 'status' => NULL);
return;
}
include_once txpath . '/publish/taghandlers.php';
/*
Get the old article permlink before anything is saved
*/
if (!$old) {
$old = array('permlink' => permlinkurl_id($id), 'status' => fetch('Status', 'textpattern', 'ID', $id));
return;
}
/*
Clear the permlink cache
*/
unset($GLOBALS['permlinks'][$id]);
/*
Generate a new if permlink has changed or if article is published
*/
if (callback_event('rah_bitly.update') !== '') {
return;
}
if ($updated == false && ($permlink = permlinkurl_id($id)) && ($old['permlink'] != $permlink || !ps('custom_' . $prefs['rah_bitly_field']) || $old['status'] != ps('Status'))) {
$uri = self::fetch($permlink);
if ($uri) {
$fields = getCustomFields();
if (!isset($fields[$prefs['rah_bitly_field']])) {
return;
}
safe_update('textpattern', 'custom_' . intval($prefs['rah_bitly_field']) . "='" . doSlash($uri) . "'", "ID='" . doSlash($id) . "'");
$_POST['custom_' . $prefs['rah_bitly_field']] = $uri;
}
$updated = true;
}
if (!empty($uri)) {
echo script_js('$(\'input[name="custom_' . $prefs['rah_bitly_field'] . '"]\').val("' . escape_js($uri) . '");');
}
}
示例7: yab_shop_build_cart
function yab_shop_build_cart($cart)
{
$cart_display = '';
if ($cart->itemcount > 0) {
foreach ($cart->get_contents() as $item) {
$cart_display .= tag(href($item['name'], permlinkurl_id($item['txpid'])) . tag(tag(yab_shop_lang('price') . ': ' . yab_shop_currency_out(yab_shop_config('currency'), 'cur') . yab_shop_currency_out(yab_shop_config('currency'), 'toform', $item['price']), 'li', ' class="yab-price"') . tag(yab_shop_lang('quantity') . ': ' . $item['qty'], 'li', ' class="yab-qty"'), 'ul'), 'li', ' class="yab-item"');
}
$cart_display = tag($cart_display, 'ul', ' class="yab-cart"');
$cart_display .= tag(yab_shop_lang('sub_total') . ': ' . yab_shop_currency_out(yab_shop_config('currency'), 'cur') . yab_shop_currency_out(yab_shop_config('currency'), 'toform', $cart->total), 'span', ' class="yab-subtotal"');
$cart_display .= tag(yab_shop_lang('to_checkout'), 'a', ' href="' . pagelinkurl(array('s' => yab_shop_config('checkout_section_name'))) . '" title="' . yab_shop_lang('to_checkout') . '" class="yab-to-checkout"');
} else {
$cart_display = tag(yab_shop_lang('empty_cart'), 'span', ' class="yab-empty"');
}
return $cart_display;
}
示例8: sed_cp_new_comment_digest
function sed_cp_new_comment_digest($atts)
{
global $_sed_cp_new_cmts;
/*
Outputs a digest of comments since the viewer's last visit to the site (if any)...
*/
extract(lAtts(array('class' => __FUNCTION__, 'wraptag' => 'ul', 'break' => 'li', 'label' => '', 'labeltag' => '', 'limit' => '0', 'more' => ' …', 'max_visit' => 7200, 'empty' => gTxt('none')), $atts));
$new_comments = _sed_cp_get_comments($max_visit);
if ($_sed_cp_new_cmts > 0) {
$row_count = count($new_comments);
if ($limit === '0' || intval($limit) < 0 || $row_count === intval($limit)) {
$limit = $row_count + 1;
} else {
$limit = intval($limit);
}
foreach ($new_comments as $comment) {
extract($comment);
$item = href(escape_title($Title) . "({$new_com_count})", permlinkurl_id($parentid) . '#c' . $first_new);
if (--$limit <= 0) {
$items[] = $item . $more;
break;
} else {
$items[] = $item;
}
}
} else {
$items[] = $empty;
}
return doLabel($label, $labeltag) . doWrap($items, $wraptag, $break, $class);
}
示例9: article_edit
//.........这里部分代码省略.........
//-- recent articles --------------
echo '<div id="recent_group"><h3 class="plain lever' . (get_pref('pane_article_recent_visible') ? ' expanded' : '') . '"><a href="#recent">' . gTxt('recent_articles') . '</a>' . '</h3>' . '<div id="recent" class="toggle" style="display:' . (get_pref('pane_article_recent_visible') ? 'block' : 'none') . '">';
$recents = safe_rows_start("Title, ID", 'textpattern', "1=1 order by LastMod desc limit 10");
$ra = '';
if ($recents) {
$ra = '<ul class="recent plain-list">';
while ($recent = nextRow($recents)) {
if (!$recent['Title']) {
$recent['Title'] = gTxt('untitled') . sp . $recent['ID'];
}
$ra .= n . t . '<li class="recent-article"><a href="?event=article' . a . 'step=edit' . a . 'ID=' . $recent['ID'] . '">' . escape_title($recent['Title']) . '</a></li>';
}
$ra .= '</ul>';
}
echo pluggable_ui('article_ui', 'recent_articles', $ra, $rs);
echo '</div></div>';
} else {
echo sp;
}
echo '</div></td>' . n . '<td id="article-main"><div id="main_content">';
//-- title input --------------
if ($view == 'preview') {
echo '<div class="preview">' . hed(gTxt('preview'), 2) . hed($Title, 1, ' class="title"');
} elseif ($view == 'html') {
echo '<div class="xhtml">' . hed('XHTML', 2) . hed($Title, 1, ' class="title"');
} elseif ($view == 'text') {
echo '<div class="text">' . pluggable_ui('article_ui', 'title', n . '<p class="title"><label for="title">' . gTxt('title') . '</label>' . sp . popHelp('title') . br . '<input type="text" id="title" name="Title" value="' . escape_title($Title) . '" class="edit" size="40" tabindex="1" />', $rs);
if ($step != 'create') {
if ($Status != 4 and $Status != 5) {
$url = '?txpreview=' . intval($ID) . '.' . time();
// article ID plus cachebuster
} else {
include_once txpath . '/publish/taghandlers.php';
$url = permlinkurl_id($ID);
}
echo sp . sp . '<a href="' . $url . '" class="article-view">' . gTxt('view') . '</a>';
}
echo '</p>';
}
//-- body --------------------
if ($view == 'preview') {
echo '<div class="body">';
if ($textile_body == USE_TEXTILE) {
echo $textile->TextileThis($Body);
} else {
if ($textile_body == CONVERT_LINEBREAKS) {
echo nl2br($Body);
} else {
if ($textile_body == LEAVE_TEXT_UNTOUCHED) {
echo $Body;
}
}
}
echo '</div>';
} elseif ($view == 'html') {
if ($textile_body == USE_TEXTILE) {
$bod = $textile->TextileThis($Body);
} else {
if ($textile_body == CONVERT_LINEBREAKS) {
$bod = nl2br($Body);
} else {
if ($textile_body == LEAVE_TEXT_UNTOUCHED) {
$bod = $Body;
}
}
}
示例10: article_edit_form
function article_edit_form($step, $view, $from_view, $article)
{
global $txpcfg, $txp_user, $article_vars;
extract(get_prefs());
extract($article);
if ($step != 'create') {
// Previous record?
$prev_id = checkIfNeighbour('prev', $sPosted);
// Next record?
$next_id = checkIfNeighbour('next', $sPosted);
}
echo n . n . '<form name="article" method="post" action="index.php" enctype="multipart/form-data">';
if ($view != 'text') {
echo hInput('store', base64_encode(serialize($article)));
}
echo hInput('ID', $ID) . eInput('article') . sInput($step) . '<input type="hidden" name="view" />' . startTable('edit') . '<tr>' . n . '<td id="article-col-1">';
if ($view == 'text') {
//-- markup help --------------
echo side_help($markup_body, $markup_excerpt) . '<h3 class="plain"><a href="#advanced" onclick="toggleDisplay(\'advanced\'); return false;">' . gTxt('advanced_options') . '</a></h3>', '<div id="advanced" style="display:none;">', n . graf('<label for="markup-body">' . gTxt('article_markup') . '</label>' . br . pref_markup('markup_body', $markup_body, 'markup-body')), n . graf('<label for="markup-excerpt">' . gTxt('excerpt_markup') . '</label>' . pref_markup('markup_excerpt', $markup_excerpt, 'markup-excerpt')), $allow_form_override ? graf('<label for="override-form">' . gTxt('override_default_form') . '</label>' . br . form_pop($override_form, 'override-form') . sp . popHelp('override_form')) : '', n . graf('<label for="article-image">' . gTxt('article_image') . '</label>' . sp . popHelp('article_image') . br . fInput('text', 'Image', $Image, 'edit', '', '', 22, '', 'article-image')), n . graf('<label for="url-title">' . gTxt('url_title') . '</label>' . sp . popHelp('url_title') . br . fInput('text', 'url_title', $url_title, 'edit', '', '', 22, '', 'url-title')) . '</div>
<h3 class="plain"><a href="#recent" onclick="toggleDisplay(\'recent\'); return false;">' . gTxt('recent_articles') . '</a>' . '</h3>' . '<div id="recent" style="display:none;">';
$recents = safe_rows_start("Title, ID", 'textpattern', "1=1 order by LastMod desc limit 10");
if ($recents) {
echo '<ul class="plain-list">';
while ($recent = nextRow($recents)) {
if (!$recent['Title']) {
$recent['Title'] = gTxt('untitled') . sp . $recent['ID'];
}
echo n . t . '<li><a href="?event=article' . a . 'step=edit' . a . 'ID=' . $recent['ID'] . '">' . escape_title($recent['Title']) . '</a></li>';
}
echo '</ul>';
}
echo '</div>';
} else {
echo sp;
}
echo '</td>' . n . '<td id="article-main">';
//-- title input --------------
if ($view == 'preview') {
echo hed(gTxt('preview'), 2) . hed($Title, 1);
} elseif ($view == 'html') {
echo hed('XHTML', 2) . hed($Title, 1);
} else {
echo '<p><label for="title">' . gTxt('title') . '</label>';
if (($Status == 4 or $Status == 5) and $step != 'create') {
include_once txpath . '/publish/taghandlers.php';
echo sp . sp . '[<a href="' . permlinkurl_id($ID) . '">' . gTxt('view') . '</a>]';
}
echo '<br />' . n . '<input type="text" id="title" name="Title" value="' . cleanfInput($Title) . '" class="edit" size="65" tabindex="1" /></p>';
}
//-- body --------------------
if ($view == 'preview') {
echo do_markup($markup_body, $Body);
} elseif ($view == 'html') {
$bod = do_markup($markup_body, $Body);
echo tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), htmlspecialchars($bod)), 'code');
} else {
echo n . graf('<label for="body">' . gTxt('body') . '</label><br />' . n . '<textarea id="body" name="Body" cols="55" rows="31" tabindex="2">' . htmlspecialchars($Body) . '</textarea>');
}
//-- excerpt --------------------
if ($articles_use_excerpts) {
if ($view == 'text') {
echo n . graf('<label for="excerpt">' . gTxt('excerpt') . '</label>' . sp . popHelp('excerpt') . br . '<textarea id="excerpt" name="Excerpt" cols="55" rows="10" tabindex="3">' . htmlspecialchars($Excerpt) . '</textarea>');
} else {
echo n . '<hr width="50%" />';
echo $view == 'preview' ? graf(do_markup($markup_excerpt, $Excerpt)) : tag(str_replace(array(n, t), array(br, sp . sp . sp . sp), htmlspecialchars(do_markup($markup_excerpt, $Excerpt))), 'code');
}
}
//-- keywords --------------
if ($view == 'text') {
echo n . graf('<label for="keywords">' . gTxt('keywords') . '</label>' . sp . popHelp('keywords') . br . '<textarea id="keywords" name="Keywords" cols="55" rows="5">' . htmlspecialchars(str_replace(',', ', ', $Keywords)) . '</textarea>');
//-- custom fields --------------
echo $custom_1_set ? custField(1, $custom_1_set, $custom_1) : '', $custom_2_set ? custField(2, $custom_2_set, $custom_2) : '', $custom_3_set ? custField(3, $custom_3_set, $custom_3) : '', $custom_4_set ? custField(4, $custom_4_set, $custom_4) : '', $custom_5_set ? custField(5, $custom_5_set, $custom_5) : '', $custom_6_set ? custField(6, $custom_6_set, $custom_6) : '', $custom_7_set ? custField(7, $custom_7_set, $custom_7) : '', $custom_8_set ? custField(8, $custom_8_set, $custom_8) : '', $custom_9_set ? custField(9, $custom_9_set, $custom_9) : '', $custom_10_set ? custField(10, $custom_10_set, $custom_10) : '';
}
//-- author --------------
if ($view == "text" && $step != "create") {
echo '<p class="small">' . gTxt('posted_by') . ': ' . htmlspecialchars($AuthorID) . ' · ' . safe_strftime('%d %b %Y · %X', $sPosted);
if ($sPosted != $sLastMod) {
echo br . gTxt('modified_by') . ': ' . htmlspecialchars($LastModID) . ' · ' . safe_strftime('%d %b %Y · %X', $sLastMod);
}
echo '</p>';
}
echo hInput('from_view', $view);
echo '</td>';
echo '<td id="article-tabs">';
//-- layer tabs -------------------
echo graf(tab('text', $view) . br . tab('html', $view) . br . tab('preview', $view));
echo '</td>';
echo '<td id="article-col-2">';
if ($view == 'text') {
if ($step != 'create') {
echo n . graf(href(gtxt('create_new'), 'index.php?event=article'));
}
//-- prev/next article links --
if ($step != 'create' and ($prev_id or $next_id)) {
echo '<p>', $prev_id ? prevnext_link('‹' . gTxt('prev'), 'article', 'edit', $prev_id, gTxt('prev')) : '', $next_id ? prevnext_link(gTxt('next') . '›', 'article', 'edit', $next_id, gTxt('next')) : '', '</p>';
}
//-- status radios --------------
echo n . n . fieldset(status_radio($Status), gTxt('status'), 'write-status') . n . n . fieldset(n . graf('<label for="section">' . gTxt('section') . '</label> ' . '<span class="small">[' . eLink('section', '', '', '', gTxt('edit')) . ']</span>' . br . section_popup($Section, 'section')) . n . graf('<label for="category-1">' . gTxt('category1') . '</label> ' . '<span class="small">[' . eLink('category', '', '', '', gTxt('edit')) . ']</span>' . br . n . category_popup('Category1', $Category1, 'category-1')) . n . graf('<label for="category-2">' . gTxt('category2') . '</label>' . br . n . category_popup('Category2', $Category2, 'category-2')), gTxt('sort_display'), 'write-sort') . n . n . '<h3 class="plain"><a href="#more" onclick="toggleDisplay(\'more\'); return false;">' . gTxt('more') . '</a></h3>', '<div id="more" style="display: none;">';
//-- comments stuff --------------
//.........这里部分代码省略.........
示例11: product_edit
function product_edit($event, $step, $message = '')
{
global $vars, $txp_user, $comments_disabled_after, $txpcfg, $prefs;
extract($prefs);
define("IMPATH", $path_to_site . '/' . $img_dir . '/');
extract(gpsa(array('view', 'from_view', 'step')));
if (!empty($GLOBALS['ID'])) {
// newly-saved article
$ID = $GLOBALS['ID'];
$step = 'edit';
} else {
$ID = gps('ID');
}
//GET ARTICLE DATA FOR 'EDIT' & 'SAVE' STEP
//==================================
if ($step == "edit" || $step == "save" && !empty($ID)) {
$pull = true;
//-- it's an existing article - off we go to the db
$ID = assert_int($ID);
$rs = safe_row("*, unix_timestamp(Posted) as sPosted,\n\t\t\t\tunix_timestamp(LastMod) as sLastMod", "textpattern", "ID={$ID}");
extract($rs);
if ($AnnotateInvite != $comments_default_invite) {
$AnnotateInvite = $AnnotateInvite;
} else {
$AnnotateInvite = $comments_default_invite;
}
$custom_fields = safe_rows("*", "product_custom_fields", "articleID = {$ID} ORDER BY id DESC");
$step = "save";
//print_r($rs);
} else {
if (empty($step)) {
$step = "create";
}
}
$textile = new Textile();
$textile_body = $use_textile;
$textile_excerpt = $use_textile;
$page_title = "Add a new product";
$message = "";
pagetop($page_title, $message);
if (count($custom_fields) > 0) {
$startFieldNum = $custom_fields[0]['id'] + 1;
} else {
$startFieldNum = 0;
}
//JS INCLUDES
//==================================
//print_r($prefs);
echo '<script type="text/javascript" src="http://' . $siteurl . '/js/prototype.js"></script>';
echo '<script type="text/javascript" src="http://' . $siteurl . '/js/scriptaculous.js"></script>';
//CSS FOR PRODUCT DISPLAY
//==================================
echo n . '<style type="text/css">' . n . 'h4.productHeading{' . n . ' color:gray;' . n . ' margin-bottom:0px;' . n . '}' . n . 'h4.productHeading span{' . n . ' float:right;' . n . ' font-size:9px;' . n . ' font-style:italic;' . n . ' font-weight:normal;' . n . '}' . n . '.product-options-sub{' . n . ' padding: 10px;' . n . '}' . n . '.product-options-sub em{' . n . ' color:gray;' . n . '}' . n . '.product-options-sub legend{' . n . ' font-size:11px;' . n . '}' . n . '.product-options-sub label{' . n . ' font-size:11px;' . n . ' padding-bottom: 5px;' . n . '}' . n . '#images ul.plain-list li{' . n . ' float:left;' . n . ' margin-right:10px;' . n . ' margin-bottom:10px;' . n . ' width:375px;' . n . '}' . n . '#images ul.plain-list li img{' . n . ' border-width: 1px;' . n . ' border-color:#BBBBBB;' . n . ' border-style:solid;' . n . ' padding:3px;' . n . ' background-color: #E0E0E0;' . n . ' float:left;' . n . '}' . n . '#images ul.plain-list li .imageEdit{' . n . ' background-color:#E0E0E0;' . n . ' height: 15px;' . n . ' width: 250px;' . n . ' text-align:left;' . n . ' padding:3px 3px 3px 110px;' . n . ' margin-top:0px;' . n . '}' . n . '#images ul.plain-list li .imageUpload{' . n . ' margin-top: 5px;' . n . ' padding:3px;' . n . ' width: 275px;' . n . ' border-width: 1px;' . n . ' border-color:#E0E0E0;' . n . ' border-style:solid;' . n . '}' . n . '</style>';
echo n . '<script type="text/javascript">' . n . ' <!--' . n . ' fieldNum = ' . $startFieldNum . ';' . n . ' function addCustomField(index){' . n . ' //$("custom_fields").innerHTML = $("custom_fields").innerHTML + getCustomField(fieldNum);' . n . ' $("custom_fields").appendChild(getCustomField(fieldNum))' . n . ' fieldNum = fieldNum+1;' . n . ' }' . n . ' function deleteCustomField(index){' . n . ' if(confirm("Are you sure?")){' . n . ' $("custom_field_"+index).style.display = "none";' . n . ' $("custom_fields["+index+"][value]").value = "delete";' . n . ' $("custom_fields["+index+"][label]").value = "delete";' . n . ' }else{ return false; }' . n . ' }' . n . ' function getCustomField(index){' . n . ' var span = document.createElement("span");' . n . ' span.setAttribute("id","custom_field_"+index);' . n . ' var label = document.createElement("label");' . n . ' label.setAttribute("for","custom_fields["+index+"][label]");' . n . ' labelText = document.createTextNode("Label ");' . n . ' var input = document.createElement("input");' . n . ' input.setAttribute("id","custom_fields["+index+"][label]");' . n . ' input.setAttribute("name","custom_fields["+index+"][label]");' . n . ' var labelValue = document.createElement("label");' . n . ' labelValue.setAttribute("for","custom_fields["+index+"][value]");' . n . ' labelTextValue = document.createTextNode(" Value ");' . n . ' var inputValue = document.createElement("input");' . n . ' inputValue.setAttribute("id","custom_fields["+index+"][value]");' . n . ' inputValue.setAttribute("name","custom_fields["+index+"][value]");' . n . ' var deleteLink = document.createElement("a");' . n . ' deleteLink.setAttribute("href","javascript:void(0)");' . n . ' deleteLink.setAttribute("onclick","deleteCustomField("+index+");");' . n . ' deleteLink.setAttribute("style","font-size: 11px;");' . n . ' deleteText = document.createTextNode("Delete");' . n . ' label.appendChild(labelText);' . n . ' span.appendChild(label);' . n . ' span.appendChild(input);' . n . ' labelValue.appendChild(labelTextValue);' . n . ' span.appendChild(labelValue);' . n . ' span.appendChild(inputValue);' . n . ' deleteLink.appendChild(deleteText);' . n . ' span.appendChild(deleteLink);' . n . ' span.appendChild(document.createElement("br"));' . n . ' span.appendChild(document.createElement("br"));' . n . ' return span;' . n . ' }' . n . '//-->' . n . '</script>';
echo n . n . '<form name="product" method="post" action="index.php" enctype="multipart/form-data">';
echo '<input type="hidden" name="textile_body" value="1"/>';
echo '<input type="hidden" name="textile_excerpt" value="1"/>';
echo '<input type="hidden" name="Section" value="store"/>';
echo hInput('ID', $ID) . eInput('product') . sInput($step) . '<input type="hidden" name="view" />' . startTable('edit') . '<tr>' . n;
//if ($view == 'text')
//{
//-- markup help --------------
echo '<td id="article-main">';
echo "<h4 class='productHeading'>Product name</h4>";
echo '<p><input type="text" id="title" name="Title" value="' . cleanfInput($Title) . '" class="edit" size="40" tabindex="1" />';
if (($Status == 4 or $Status == 5) and $step != 'create') {
include_once txpath . '/publish/taghandlers.php';
echo sp . sp . '<a href="' . permlinkurl_id($ID) . '">' . gTxt('view') . '</a>';
}
echo '</p>';
echo "<h4 class='productHeading'><span>Textile & HTML allowed</span> Describe the product</h4>";
echo n . graf('<textarea id="body" name="Body" cols="55" rows="31" tabindex="2" style="height: 180px;">' . htmlspecialchars($Body) . '</textarea>');
//PRODUCT OPTIONS
//================================
//echo '<div id="productOptions" style="border-width:1px; border-color:#E1E1E1; border-style:solid; padding:5px; background-color:#F3F4F4;">';
//PRODUCT & PRICE
//================================
echo n . n . '<fieldset class="product-options-sub" style="background-color:white">' . '<div style="float:left; margin-right: 40px;">' . n . graf('<label for="price">Price</label> ' . br . n . '<input style="width: 50px;" type="text" name="custom_1" id="price" value="' . cleanfInput($custom_1) . '"/> <em>usd</em>') . n . '</div>' . n . graf('<label for="weight">Weight</label>' . br . n . '<input type="text" style="width: 50px;" name="custom_2" id="weight" value="' . cleanfInput($custom_2) . '"/> <em>lbs</em>');
echo n . "</fieldset>";
//CUSTOM FIELDS
//================================
if (isset($ID)) {
$custom_fields = get_custom_fields($ID);
} else {
$custom_fields = '';
}
echo n . n . '<fieldset class="product-options-sub" style="background-color:white" id="custom_fields">' . n . '<legend>Custom Fields <span>[<a href="javascript:addCustomField(0);">Add a new custom field</a>]</span></legend>';
echo $custom_fields;
echo n . "</fieldset>";
//CATEGORIES
//================================
//if(!is_callable("rss_admin_catlist")){
echo n . n . '<fieldset class="product-options-sub" style="background-color:white">' . n . '<legend>Categorize <small>[<a href="?event=category">edit</a>]</small></legend>' . '<div style="float:left; margin-right: 10px;">' . n . graf('<label for="category-1">' . gTxt('category1') . '</label> ' . n . '<select name="Category1" id="category-1"><option></option>' . n . product_cateogry_option_list($Category1) . n . '</select>') . n . '</div>' . n . graf('<label for="category-2">' . gTxt('category2') . '</label>' . n . '<select name="Category2" id="category-2"><option></option>' . n . product_cateogry_option_list($Category2) . n . '</select>');
echo n . "</fieldset>";
//}
//VENDORS
//================================
echo n . n . '<fieldset class="product-options-sub" style="background-color:white">' . n . '<legend>Vendor <em>The creator or manufacturer of the product. </em></legend>' . '<div style="float:left; width:50%;">' . n . '<label for="vendor">Select existing vendor </label> ' . br . n . build_list("vendor", "txp_category", "name", "title", $custom_5, "parent='Vendors'", true) . n . '</div>' . n . graf('<label for="new_vendor_name">Or create a new vendor</label>' . br . n . '<input id="new_vendor_name" type="text" name="new_vendor_name"/>');
echo n . "</fieldset>";
//INVENTORY
//.........这里部分代码省略.........
示例12: mail_comment
function mail_comment($message, $cname, $cemail, $cweb, $parentid, $discussid)
{
global $sitename;
$article = safe_row("Section, Posted, ID, url_title, AuthorID, Title", "textpattern", "ID = '{$parentid}'");
extract($article);
extract(safe_row("RealName, email", "txp_users", "name = '" . doSlash($AuthorID) . "'"));
$out = gTxt('greeting') . " {$RealName},\r\n\r\n";
$out .= str_replace('{title}', $Title, gTxt('comment_recorded')) . "\r\n";
$out .= permlinkurl_id($parentid) . "\r\n";
if (has_privs('discuss', $AuthorID)) {
$out .= hu . 'textpattern/?event=discuss&step=discuss_edit&discussid=' . $discussid . "\r\n";
}
$out .= "\r\n";
$out .= gTxt('comment_name') . ": {$cname}\r\n";
$out .= gTxt('comment_email') . ": {$cemail}\r\n";
$out .= gTxt('comment_web') . ": {$cweb}\r\n";
$out .= gTxt('comment_comment') . ": {$message}";
$subject = strtr(gTxt('comment_received'), array('{site}' => $sitename, '{title}' => $Title));
$success = txpMail($email, $subject, $out, $cemail);
}
示例13: article_partial_article_view
function article_partial_article_view($rs)
{
extract($rs);
if ($Status != STATUS_LIVE and $Status != STATUS_STICKY) {
$url = '?txpreview=' . intval($ID) . '.' . time();
// article ID plus cachebuster
} else {
include_once txpath . '/publish/taghandlers.php';
$url = permlinkurl_id($ID);
}
return '<span id="article_partial_article_view"><a href="' . $url . '" class="article-view">' . gTxt('view') . '</a></span>';
}
示例14: permlink
function permlink($atts, $thing = NULL)
{
global $thisarticle;
extract(lAtts(array('class' => '', 'id' => '', 'style' => '', 'title' => ''), $atts));
if (!$id) {
assert_article();
}
$url = $id ? permlinkurl_id($id) : permlinkurl($thisarticle);
if ($url) {
if ($thing === NULL) {
return $url;
}
return tag(parse($thing), 'a', ' rel="bookmark" href="' . $url . '"' . ($title ? ' title="' . $title . '"' : '') . ($style ? ' style="' . $style . '"' : '') . ($class ? ' class="' . $class . '"' : ''));
}
}
示例15: __construct
public function __construct($stars, $star_width)
{
ob_start();
$this->dbTable = 'jmd_rate';
$this->parentid = $GLOBALS['thisarticle']['thisid'];
$this->uri = permlinkurl_id($this->parentid);
$this->ip = $_SERVER['REMOTE_ADDR'];
$this->maxValue = $stars;
$this->starWidth = $star_width;
if (gps('rating')) {
$this->setRating();
}
}