当前位置: 首页>>代码示例>>PHP>>正文


PHP smarty_function_escape_special_chars函数代码示例

本文整理汇总了PHP中smarty_function_escape_special_chars函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_function_escape_special_chars函数的具体用法?PHP smarty_function_escape_special_chars怎么用?PHP smarty_function_escape_special_chars使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了smarty_function_escape_special_chars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_breadcrumb

/**
 * Campsite breadcrumb function plugin
 *
 * Type:     function
 * Name:     breadcrumb
 * Purpose:  builds the breadcrumb for the current page. A 'first_level'
 *           attribute can be passed who indicates where the breadcrumb
 *           should start.
 *
 * @param array
 *     $p_params the date in unixtime format from $smarty.now
 * @param object
 *     $p_smarty The Smarty object
 *
 * @return
 *     string the html string for the breadcrumb
 *
 * @todo make it linkable
 */
function smarty_function_breadcrumb($p_params, &$p_smarty)
{
    $p_smarty->smarty->loadPlugin('smarty_shared_escape_special_chars');
    $campsite = $p_smarty->getTemplateVars('gimme');
    if (!isset($p_params['first_level']) || empty($p_params['first_level'])) {
        $p_params['first_level'] = 'home';
    }
    if (!isset($p_params['separator']) || empty($p_params['separator'])) {
        $p_params['separator'] = ' > ';
    }
    $html = '';
    $breadcrumbStarted = 0;
    if ($p_params['first_level'] == 'home') {
        $html .= 'Home ' . $p_params['separator'];
        $breadcrumbStarted = 1;
    }
    if ($p_params['first_level'] == 'publication' || $breadcrumbStarted == 1 && $campsite->publication->defined) {
        $html .= smarty_function_escape_special_chars($campsite->publication->name) . $p_params['separator'];
        $breadcrumbStarted = 1;
    }
    if ($p_params['first_level'] == 'issue' || $breadcrumbStarted == 1 && $campsite->issue->defined) {
        $html .= smarty_function_escape_special_chars($campsite->issue->name) . $p_params['separator'];
        $breadcrumbStarted = 1;
    }
    if ($p_params['first_level'] == 'section' || $breadcrumbStarted == 1 && $campsite->section->defined) {
        $html .= smarty_function_escape_special_chars($campsite->section->name) . $p_params['separator'];
        $breadcrumbStarted = 1;
    }
    if ($campsite->article->defined) {
        $html .= smarty_function_escape_special_chars($campsite->article->name) . $p_params['separator'];
    }
    return $html;
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:52,代码来源:function.breadcrumb.php

示例2: smarty_parse_html_options

function smarty_parse_html_options($options, $params, $html)
{
    /* @var $html XMLWriter */
    foreach ($options as $k => $v) {
        if (is_array($v)) {
            $html->startElement('optgroup');
            $html->writeAttribute('label', smarty_function_escape_special_chars($k));
            $html = smarty_parse_html_options($v, $params, $html);
            $html->endElement();
        } else {
            $html->startElement('option');
            if ($params['label_as_value']) {
                $html->writeAttribute('value', smarty_function_escape_special_chars($v));
                if ($params['selected'] == $v) {
                    $html->writeAttribute('selected', 'selected');
                }
            } else {
                $html->writeAttribute('value', smarty_function_escape_special_chars($k));
                if ($params['selected'] == $k) {
                    $html->writeAttribute('selected', 'selected');
                }
            }
            $html->writeRaw($v);
            $html->endElement();
        }
    }
    return $html;
}
开发者ID:salomalo,项目名称:php-oxygen,代码行数:28,代码来源:function.html_select.php

示例3: smarty_function_oos_address_label

/**
 * Smarty {oos_address_label} function plugin
 *
 * Type:     function
 * Name:     oos_address_label
 * Version:  1.0
 * -------------------------------------------------------------
 */

function smarty_function_oos_address_label($params, &$smarty)
{

    $customers_id = '';
    $address_id = 1;
    $html = true;
    $boln = '';
    $eoln = '<br>';

    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    MyOOS_CoreApi::requireOnce('lib/smarty-plugins/myoos/function.oos_address_format.php');

    foreach($params as $_key => $_val) {
      $$_key = smarty_function_escape_special_chars($_val);
    }

    $dbconn =& oosDBGetConn();
    $oostable =& oosDBGetTables();

    $address_result = $dbconn->Execute("SELECT entry_firstname AS firstname, entry_lastname AS lastname, entry_company AS company, entry_street_address AS street_address, entry_suburb AS suburb, entry_city AS city, entry_postcode AS postcode, entry_state AS state, entry_zone_id AS zone_id, entry_country_id AS country_id FROM " . $oostable['address_book'] . " WHERE customers_id = '" . (int)$customers_id . "' AND address_book_id = '" . (int)$address_id . "'");
    $address = $address_result->fields;

    $format_id = oos_get_address_format_id($address['country_id']);


    return smarty_function_oos_address_format(array('address_format_id' => $format_id,
                                                    'address'   => $address,
                                                    'html'      => $html),
                                                  $smarty);


}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:41,代码来源:function.oos_address_label.php

示例4: smarty_block_search_form

/**
 * Campsite search_form block plugin
 *
 * Type:     block
 * Name:     search_form
 * Purpose:  Provides a...
 *
 * @param string $p_params
 *
 * @param string $p_content
 *
 * @param string $p_smarty
 *
 *
 * @return string $html
 */
function smarty_block_search_form($p_params, $p_content, &$p_smarty)
{
    if (!isset($p_content)) {
        return '';
    }

    require_once $p_smarty->_get_plugin_filepath('shared','escape_special_chars');

    // gets the context variable
    $campsite = $p_smarty->get_template_vars('gimme');

    $url = $campsite->url;
    $url->uri_parameter = "";
    $template = null;
    if (isset($p_params['template'])) {
        $template = new MetaTemplate($p_params['template']);
        if (!$template->defined()) {
            CampTemplate::singleton()->trigger_error('invalid template "' . $p_params['template']
            . '" specified in the search form');
            return false;
        }
    } elseif (is_numeric($url->get_parameter('tpl'))) {
        $template = $campsite->default_template;
    }
    if (!isset($p_params['submit_button'])) {
        $p_params['submit_button'] = 'Submit';
    }
    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }
    if (!isset($p_params['button_html_code']) || empty($p_params['button_html_code'])) {
        $p_params['button_html_code'] = '';
    }

    $searchListIdPrefix = $campsite->list_id_prefix('SearchResultsList');
    if (isset($template)) {
        $url->uri_parameter = "template " . str_replace(' ', "\\ ", $template->name);
    }
    $html = "<form name=\"search_articles\" action=\"" . $url->uri_path . "\" method=\"post\" "
    .$p_params['html_code'].">\n";
    if (isset($template)) {
        $html .= "<input type=\"hidden\" name=\"tpl\" value=\"" . $template->identifier . "\" />\n";
    }
    foreach ($campsite->url->form_parameters as $param) {
        if (strncasecmp($param[name], $searchListIdPrefix, strlen($searchListIdPrefix)) == 0) {
            continue;
        }
        if ($param['name'] == 'tpl') {
            continue;
        }
        $html .= '<input type="hidden" name="'.$param['name']
        .'" value="'.htmlentities($param['value'])."\" />\n";
    }
    $html .= $p_content;
    $html .= "<input type=\"submit\" name=\"f_search_articles\" value=\""
    .smarty_function_escape_special_chars($p_params['submit_button'])
    ."\" ".$p_params['button_html_code']." />\n</form>\n";

    return $html;
} // fn smarty_block_search_form
开发者ID:nistormihai,项目名称:Newscoop,代码行数:76,代码来源:block.search_form.php

示例5: smarty_function_from_to

/**
 * Smarty {from_to} function plugin
 *
 * Type:       function<br>
 * Name:       from_to<br>
 * Date:       2008/09/07<br>
 * Input:
 * <pre>
 *           - from       (required) - string 
 *           - to         (required) - string 
 *           - separator  (optional) - string default " ~ ". ie "-", "~<br />". 常にエスケープせずに出力するので注意.
 *           - escape     (optional) - string default true. other false. エスケープするか否か。
 * </pre>
 * Examples:
 * <pre>
 * {html_radios from="-1" to="2"} → -1 ~ 2
 * {html_radios from="B" to="a" separator="~<br />"}  → B~<br />a
 * </pre>
 * @author     Seasoft 塚田将久
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_from_to($params, &$smarty)
{
    require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
    $from = null;
    $to = null;
    $separator = ' ~ ';
    $escape = true;
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'from':
            case 'to':
            case 'separator':
            case 'escape':
                ${$_key} = (string) $_val;
                break;
            default:
                $smarty->trigger_error("from_to: extra attribute '{$_key}' is unknown.", E_USER_NOTICE);
                break;
        }
    }
    if ($escape) {
        $from = smarty_function_escape_special_chars($from);
        $to = smarty_function_escape_special_chars($to);
    }
    if ($from === $to) {
        return $from;
    } else {
        return $from . $separator . $to;
    }
}
开发者ID:nassos9090,项目名称:plugin,代码行数:54,代码来源:function.from_to.php

示例6: smarty_function_rating_input

/**
 * Smarty {rating_input} function plugin
 *
 * File:       function.rating_input.php<br>
 * Type:       function<br>
 * Name:       rating_input<br>
 * Purpose:    Prints out a rating input control<br>
 * Input:<br>
 *           - name       (optional) - string default "checkbox"
 *           - value      (required) - string
 *           - id         (optional) - checkbox id (name is default)
 * @return string
 */
function smarty_function_rating_input($params, &$smarty)
{
    require_once SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php';
    //$smarty->loadPlugin('Smarty_shared_escape_special_chars');
    $name = 'rating';
    $value = null;
    $extra = '';
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'name':
            case 'id':
            case 'value':
                ${$_key} = $_val;
                break;
            default:
                if (!is_array($_val)) {
                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
                } else {
                    $smarty->trigger_error("rating_input: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
        }
    }
    // assign default id
    if (empty($id)) {
        $id = $name;
    }
    $_output = '';
    $_output .= '<input type="text" size="10" maxlength="4"' . ' name="' . smarty_function_escape_special_chars($name) . '"' . ' id="' . smarty_function_escape_special_chars($id) . '"' . ' value="' . smarty_function_escape_special_chars($value) . '"';
    $_output .= $extra . ' />';
    for ($i = 1; $i <= 10; $i++) {
        $_output .= " <a href='#' onclick='document.edi." . $name . ".value=\"" . $i . '.0"\'>' . $i . '</a>';
    }
    return $_output;
}
开发者ID:Boris-de,项目名称:videodb,代码行数:48,代码来源:function.rating_input.php

示例7: smarty_function_html_hidden

/**
 * Smarty {html_hidden} function plugin
 *
 * Type:     function<br>
 * Name:     html_hidden<br>
 * Input:<br>
 *           - values     (required) - array
 * 
 * Purpose:  Prints the list of <hidden> tags for array parameter values
 * 
 * @author Mitsutaka Sato
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_html_hidden($params, &$smarty)
{
    require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
    $values = null;
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'values':
                ${$_key} = $_val;
                break;
        }
    }
    if (!is_array($values)) {
        return '';
    }
    $_html_result = '';
    foreach ($values as $_key => $_val) {
        if (is_array($_val)) {
            foreach ($_val as $i => $v) {
                $_html_result .= '<input type="hidden" name="' . smarty_function_escape_special_chars($_key . '[' . $i . ']') . '" value="' . smarty_function_escape_special_chars($v) . '" />' . "\n";
            }
        } else {
            $_html_result .= '<input type="hidden" name="' . smarty_function_escape_special_chars($_key) . '" value="' . smarty_function_escape_special_chars($_val) . '" />' . "\n";
        }
    }
    return $_html_result;
}
开发者ID:miztaka,项目名称:teeple2,代码行数:42,代码来源:function.html_hidden.php

示例8: smarty_function_html_js_inputbox

/**
 * Smarty {html_js_inputbox} function plugin
 *
 * File:       function.html_js_inputbox.php<br>
 * Type:       function<br>
 * Name:       js_inputbox<br>
 * Date:       06.Oct.2005<br>
 * Purpose:    Prints out a list of text input types<br>
 * Examples:
 * <pre>
 * {html_js_inputbox values=$ids}
 * {html_js_inputbox class='inputbox' name='searchword' value=$lang.text }
 * </pre>
 * @author r23 <info@r23.de>
 * @version    1.0
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_html_js_inputbox($params, &$smarty)
{
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    $class = 'inputbox';
    $name = 'keywords';
    $size = '20';
    $maxlength = '40';
    $value = 'search...';
    $extra = '';
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'class':
            case 'name':
            case 'value':
                ${$_key} = (string) $_val;
                break;
            case 'size':
            case 'maxlength':
                ${$_key} = intval($_val);
                break;
            default:
                if (!is_array($_val)) {
                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
                } else {
                    $smarty->trigger_error("html_js_inputbox: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
        }
    }
    return '<input class="' . $class . '" type="text" name="' . $name . '" size="' . $size . '" maxlength="' . $maxlength . '"  value="' . $value . '"  onblur="if(this.value==\'\') this.value=\'' . $value . '\';" onfocus="if(this.value==\'' . $value . '\') this.value=\'\';" />';
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:51,代码来源:function.html_js_inputbox.php

示例9: smarty_block_user_form

/**
 * Campsite user_form block plugin
 *
 * Type:     block
 * Name:     user_form
 * Purpose:  Provides a...
 *
 * @param string
 *     $p_params
 * @param string
 *     $p_smarty
 * @param string
 *     $p_content
 *
 * @return
 *
 */
function smarty_block_user_form($p_params, $p_content, &$p_smarty, &$p_repeat)
{
    $p_smarty->smarty->loadPlugin('smarty_function_get_resource_id');
    $resourceId = smarty_function_get_resource_id($p_params, $p_smarty);
    if (!isset($p_content)) {
        return null;
    }
    $p_smarty->smarty->loadPlugin('smarty_shared_escape_special_chars');
    $campsite = $p_smarty->getTemplateVars('gimme');
    $url = $campsite->url;
    $url->uri_parameter = "";
    $template = null;
    if (isset($p_params['template'])) {
        $template = new MetaTemplate($resourceId);
        if (!$template->defined()) {
            CampTemplate::singleton()->trigger_error('invalid template "' . $p_params['template'] . '" specified in the user form');
            return false;
        }
    } elseif (is_numeric($url->get_parameter('tpl'))) {
        $template = $campsite->default_template;
    }
    if (!isset($p_params['submit_button'])) {
        require_once $GLOBALS['g_campsiteDir'] . '/admin-files/localizer/Localizer.php';
        if (!isGS('Submit')) {
            camp_load_translation_strings("globals", $campsite->language->code);
        }
        $p_params['submit_button'] = getGS('Submit');
    }
    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }
    if (!isset($p_params['button_html_code']) || empty($p_params['button_html_code'])) {
        $p_params['button_html_code'] = '';
    }
    if (isset($template)) {
        $url->uri_parameter = "template " . str_replace(' ', "\\ ", $template->name);
    }
    if ($campsite->user->defined && $campsite->user->subscription->defined) {
        $subsType = $campsite->user->subscription->type == 'T' ? 'trial' : 'paid';
    } else {
        $subsType = null;
    }
    $html = "<form name=\"edit_user\" action=\"" . $url->uri_path . "\" method=\"post\" " . $p_params['html_code'] . ">\n";
    if (!is_null($subsType)) {
        $html .= "<input type=\"hidden\" name=\"f_substype\" value=\"" . $subsType . "\" />\n";
    }
    if (isset($template)) {
        $html .= "<input type=\"hidden\" name=\"tpl\" value=\"" . $template->identifier . "\" />\n";
    }
    foreach ($campsite->url->form_parameters as $param) {
        if ($param['name'] == 'tpl') {
            continue;
        }
        $html .= '<input type="hidden" name="' . $param['name'] . '" value="' . htmlentities($param['value']) . "\" />\n";
    }
    $html .= $p_content;
    $html .= "<input type=\"submit\" name=\"f_edit_user\" value=\"" . smarty_function_escape_special_chars($p_params['submit_button']) . "\" " . $p_params['button_html_code'] . " />\n</form>\n";
    return $html;
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:76,代码来源:block.user_form.php

示例10: smarty_function_html_options_optgroup

function smarty_function_html_options_optgroup($key,$values,$selected) {
$optgroup_html = '<optgroup label="'.smarty_function_escape_special_chars($key) .'">'."\n";
foreach ($values as $key =>$value) {
$optgroup_html .= smarty_function_html_options_optoutput($key,$value,$selected);
}
$optgroup_html .= "</optgroup>\n";
return $optgroup_html;
}
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:8,代码来源:function.html_options.php

示例11: smarty_block_paypal_payment_form

/**
 * Newscoop paypal_payment_form block plugin
 *
 * Type:     block
 * Name:     paypal_payment_form
 * Purpose:  Displays a form for paypal cart
 *
 * @param string
 *     $params
 * @param string
 *     $p_smarty
 * @param string
 *     $content
 *
 * @return
 *
 */
function smarty_block_paypal_payment_form($params, $content, &$smarty, &$repeat)
{
    if (!isset($content)) {
        return '';
    }
    $smarty->smarty->loadPlugin('smarty_shared_escape_special_chars');
    $context = $smarty->getTemplateVars('gimme');
    $container = \Zend_Registry::get('container');
    $subscriptionService = $container->getService('paywall.subscription.service');
    $subscriptionsConfig = $subscriptionService->getSubscriptionsConfig();
    $url = $context->url;
    $choosenSubscription = $subscriptionService->getOneById($params['subscriptionId']);
    if (!$choosenSubscription) {
        throw new Exception("Subscription don't exists", 1);
    }
    $formData = array('seller_email' => $subscriptionsConfig['paypal_config']['seller_email'], 'paypal_url' => 'https://www.paypal.com/cgi-bin/webscr', 'subscription_id' => $choosenSubscription->getId(), 'subscription_amount' => $choosenSubscription->getToPay(), 'subscription_currency' => $choosenSubscription->getCurrency(), 'subscription_item_name' => str_replace('%publication_name%', $context->publication->name, $subscriptionsConfig['paypal_config']['item_name_format']), 'language_code' => $context->language->code);
    if (isset($params['test'])) {
        $formData['paypal_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
        $formData['seller_email'] = $subscriptionsConfig['paypal_config']['test_seller_email'];
    }
    if (!isset($params['submit_button'])) {
        $params['submit_button'] = 'Buy subscription';
    }
    if (!isset($params['html_code']) || empty($params['html_code'])) {
        $params['html_code'] = '';
    }
    if (!isset($params['button_html_code']) || empty($params['button_html_code'])) {
        $params['button_html_code'] = '';
    }
    $html = '<form name="subscribe_content" action="' . $formData['paypal_url'] . '" method="post" ' . $params['html_code'] . '>' . "\n";
    if (isset($template)) {
        $html .= "<input type=\"hidden\" name=\"tpl\" value=\"" . $template->identifier . "\" />\n";
    }
    $html .= '<input type="hidden" name="cmd" value="_xclick">' . "\n";
    $html .= '<input type="hidden" name="business" value="' . $formData['seller_email'] . '">' . "\n";
    $html .= '<input type="hidden" name="item_name" value="' . smarty_function_escape_special_chars($formData['subscription_item_name']) . '">' . "\n";
    $html .= '<input type="hidden" name="item_number" value="' . $formData['subscription_id'] . '">' . "\n";
    $html .= '<input type="hidden" name="amount" value="' . $formData['subscription_amount'] . '">' . "\n";
    $html .= '<input type="hidden" name="display" value="1">' . "\n";
    $html .= '<input type="hidden" name="no_shipping" value="1">' . "\n";
    $html .= '<input type="hidden" name="no_note" value="1"> ' . "\n";
    $html .= '<input type="hidden" name="currency_code" value="' . $formData['subscription_currency'] . '"> ' . "\n";
    $html .= '<input type="hidden" name="lc" value="' . $formData['language_code'] . '">' . "\n";
    $html .= '<input type="hidden" name="return" value="' . $container->get('router')->generate('newscoop_paywall_default_statussuccess', array(), true) . '">' . "\n";
    $html .= '<input type="hidden" name="cancel_return" value="' . $container->get('router')->generate('newscoop_paywall_default_statuscancel', array(), true) . '">' . "\n";
    $html .= '<input type="hidden" name="notify_url" value="' . $container->get('router')->generate('newscoop_paywall_default_callback', array(), true) . '">' . "\n";
    $html .= '<input type="hidden" name="custom" value="' . $choosenSubscription->getId() . '__' . $choosenSubscription->getUser()->getId() . '">' . "\n";
    foreach ($context->url->form_parameters as $param) {
        if ($param['name'] == 'tpl') {
            continue;
        }
        $html .= '<input type="hidden" name="' . $param['name'] . '" value="' . htmlentities($param['value']) . "\" />\n";
    }
    $html .= $content;
    $html .= "<input type=\"submit\" name=\"submit_form\" id=\"paypal_form_submit\" value=\"" . smarty_function_escape_special_chars($params['submit_button']) . "\" " . $params['button_html_code'] . " />\n";
    $html .= "</form>\n";
    return $html;
}
开发者ID:riverans,项目名称:plugin-NewscoopPaywallBundle,代码行数:75,代码来源:block.paypal_payment_form.php

示例12: smarty_function_html_checkboxes_output

function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator)
{
    $_output = '<input type="checkbox" name="' . smarty_function_escape_special_chars($name) . '[]" value="' . smarty_function_escape_special_chars($value) . '"';
    if (in_array($value, $selected)) {
        $_output .= ' checked="checked"';
    }
    $_output .= $extra . ' />' . $output . $separator . "\n";
    return $_output;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:9,代码来源:function.html_checkboxes.php

示例13: smarty_block_comment_form

/**
 * Campsite comment_form block plugin
 *
 * Type:     block
 * Name:     comment_form
 * Purpose:  Displays a form for comment input
 *
 * @param string
 *     $p_params
 * @param string
 *     $p_smarty
 * @param string
 *     $p_content
 *
 * @return
 *
 */
function smarty_block_comment_form($p_params, $p_content, &$p_smarty, &$p_repeat)
{
    if (!isset($p_content)) {
        return '';
    }
    $p_smarty->smarty->loadPlugin('smarty_shared_escape_special_chars');
    $campsite = $p_smarty->getTemplateVars('gimme');
    if (!$campsite->article->comments_enabled) {
        return '';
    }
    $url = $campsite->url;
    $url->uri_parameter = "";
    $template = null;
    if (isset($p_params['template'])) {
        $themePath = $campsite->issue->defined() ? $campsite->issue->theme_path : $campsite->publication->theme_path;
        $template = new MetaTemplate($p_params['template'], $themePath);
        if (!$template->defined()) {
            CampTemplate::singleton()->trigger_error('invalid template "' . $p_params['template'] . '" specified in the comment form');
            return false;
        }
    } elseif (is_numeric($url->get_parameter('tpl'))) {
        $template = $campsite->default_template;
    }
    if (!isset($p_params['submit_button'])) {
        $p_params['submit_button'] = 'Submit';
    }
    $anchor = isset($p_params['anchor']) ? '#' . $p_params['anchor'] : null;
    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }
    if (!isset($p_params['button_html_code']) || empty($p_params['button_html_code'])) {
        $p_params['button_html_code'] = '';
    }
    if (isset($template)) {
        $url->uri_parameter = "template " . str_replace(' ', "\\ ", $template->name);
    }
    $html = "<form name=\"submit_comment\" action=\"" . $url->uri_path . "{$anchor}\" " . "method=\"post\" " . $p_params['html_code'] . ">\n";
    if (isset($template)) {
        $html .= "<input type=\"hidden\" name=\"tpl\" value=\"" . $template->identifier . "\" />\n";
    }
    foreach ($campsite->url->form_parameters as $param) {
        if ($param['name'] == 'tpl') {
            continue;
        }
        $html .= '<input type="hidden" name="' . $param['name'] . '" value="' . htmlentities($param['value']) . "\" />\n";
    }
    if ($campsite->comment->identifier > 0) {
        $html .= "<input type=\"hidden\" name=\"acid\" " . "value=\"" . $campsite->comment->identifier . "\" />\n";
    }
    $html .= $p_content;
    $html .= "<input type=\"submit\" name=\"f_submit_comment\" " . "id=\"article_comment_submit\" value=\"" . smarty_function_escape_special_chars($p_params['submit_button']) . "\" " . $p_params['button_html_code'] . " />\n";
    if (isset($p_params['preview_button']) && !empty($p_params['preview_button'])) {
        $html .= "<input type=\"submit\" name=\"f_preview_comment\" " . "id=\"article_comment_preview\" value=\"" . smarty_function_escape_special_chars($p_params['preview_button']) . "\" " . $p_params['button_html_code'] . " />\n";
    }
    $html .= "</form>\n";
    return $html;
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:74,代码来源:block.comment_form.php

示例14: smarty_function_interviewitem_edit

/**
 * Campsite interview_edit function plugin
 *
 * Type:     function
 * Name:     camp_edit
 * Purpose:  
 *
 * @param array
 *     $p_params the date in unixtime format from $smarty.now
 * @param object
 *     $p_smarty the date format wanted
 *
 * @return
 *     string the html form element
 *     string empty if something is wrong
 */
function smarty_function_interviewitem_edit($p_params, &$p_smarty)
{
    global $g_ado_db;

    require_once $p_smarty->_get_plugin_filepath('shared','escape_special_chars');

    // gets the context variable
    $campsite = $p_smarty->get_template_vars('gimme');
    $html = '';

    if (!isset($p_params['attribute'])) {
        return $html;
    }
    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }

    $object = strtolower($p_params['object']);
    $attribute = strtolower($p_params['attribute']);

    // gets the attribute value from the context
    $attrValue = $campsite->interviewitem->$attribute;

    $txtAreaFields = array('question', 'answer');
    $selectFields = array('status');

    if (in_array($attribute, $txtAreaFields)) {
        $html = '<textarea name="f_interviewitem_'.$attribute.'" cols="40" rows="4" '.$p_params['html_code'].'>';
        $html .= isset($_REQUEST["f_interviewitem_$attribute"]) ? 
            smarty_function_escape_special_chars($_REQUEST["f_interviewitem_$attribute"]) : 
            smarty_function_escape_special_chars($attrValue);
        $html .= '</textarea>';
            
    } elseif (in_array($attribute, $selectFields)) {
        require_once $p_smarty->_get_plugin_filepath('function','html_options');
        
        switch ($attribute) {            
            case 'status':
                $options = array('draft' => 'draft', 'pending' => 'pending', 'published' => 'published', 'rejected' => 'rejected');   

                $html = '<select name="f_interviewitem_status" id="interview_"'.$attribute.'>';
                $html.= smarty_function_html_options(array(
                    'options' => $options,
                    'selected' => isset($_REQUEST['f_interview_status']) ? $_REQUEST['f_interview_status']: $attrValue,
                    'print_result' => false),
                    $p_smarty
                );
                $html .= '</select>';
            break;
        } 
    }
    
    return $html;
} // fn smarty_function_interview_edit
开发者ID:nistormihai,项目名称:Newscoop,代码行数:70,代码来源:function.interviewitem_edit.php

示例15: smarty_function_oos_cost

function smarty_function_oos_cost($params, &$smarty)
{
    global $oCurrencies;
    MyOOS_CoreApi::requireOnce('lib/smarty/libs/plugins/shared.escape_special_chars.php');
    $price = '';
    $tax = '';
    foreach ($params as $_key => $_val) {
        ${$_key} = smarty_function_escape_special_chars($_val);
    }
    print $oCurrencies->format(oos_add_tax($price, $tax));
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:11,代码来源:function.oos_shipping_cost.php


注:本文中的smarty_function_escape_special_chars函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。