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


PHP open_html_tag函数代码示例

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


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

示例1: smarty_block_submit

/**
 * Render submit button
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_submit($params, $content, &$smarty, &$repeat)
{
    $params['type'] = 'submit';
    $accesskey = array_var($params, 'accesskey', 's');
    if ($accesskey) {
        $params['accesskey'] = 's';
    }
    // if
    $caption = clean(isset($params['not_lang']) ? $content : lang($content));
    if ($accesskey) {
        $first = null;
        $first_pos = null;
        $to_highlight = array(strtolower($accesskey), strtoupper($accesskey));
        foreach ($to_highlight as $accesskey_to_highlight) {
            if (($pos = strpos($caption, $accesskey_to_highlight)) === false) {
                continue;
            }
            // if
            if ($first_pos === null || $pos < $first_pos) {
                $first = $accesskey_to_highlight;
                $first_pos = $pos;
            }
            // if
        }
        // foreach
        if ($first !== null) {
            $caption = str_replace_first($first, "<u>{$first}</u>", $caption);
        }
        // if
    }
    // if
    // And done...
    return open_html_tag('button', $params) . '<span><span>' . $caption . '</span></span></button>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:43,代码来源:block.submit.php

示例2: smarty_function_object_user_star

/**
 * Render star for a given user page
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_user_star($params, &$smarty)
{
    static $ids = array();
    $starred_user_id = array_var($params, 'starred_user_id');
    $starred_page_type = array_var($params, 'starred_page_type');
    $starred_by_user_id = array_var($params, 'starred_by_user_id');
    $project_id = array_var($params, 'project_id');
    $id = array_var($params, 'id');
    if (empty($id)) {
        do {
            $id = 'object_star_' . make_string(40);
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    mysql_select_db(DB_NAME, $link);
    $query = "select * from healingcrystals_starred_user_pages where starred_by_user_id='" . $starred_by_user_id . "' and starred_user_id='" . $starred_user_id . "' and starred_page_type='" . $starred_page_type . "'";
    $result = mysql_query($query);
    $is_starred = false;
    if (mysql_num_rows($result)) {
        $is_starred = true;
    }
    mysql_close($link);
    if ($is_starred) {
        $params = array('id' => $id, 'href' => assemble_url('unstar_user_' . $starred_page_type . '_page', array('project_id' => $project_id, 'user_id' => $starred_by_user_id)) . '&starred_user_id=' . $starred_user_id, 'title' => lang('Unstar this object'), 'class' => 'object_star');
        $result = open_html_tag('a', $params) . '<img src="' . get_image_url('icons/star-small.gif') . '" alt="" /></a>';
    } else {
        $params = array('id' => $id, 'href' => assemble_url('star_user_' . $starred_page_type . '_page', array('project_id' => $project_id, 'user_id' => $starred_by_user_id)) . '&starred_user_id=' . $starred_user_id, 'title' => lang('Star this object'), 'class' => 'object_star');
        $result = open_html_tag('a', $params) . '<img src="' . get_image_url('icons/unstar-small.gif') . '" alt="" /></a>';
    }
    // if
    return $result . "\n<script type=\"text/javascript\">App.layout.init_star_unstar_link('" . $id . "')</script>";
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:41,代码来源:function.object_user_star.php

示例3: smarty_function_checkbox_field

/**
 * Render checkbox field
 * 
 * Parameters:
 * 
 * - name - Field name
 * - value - Initial value. Value of this field is ignored if checked attribute 
 *   is present
 * - array of additional attributes
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_checkbox_field($params, &$smarty)
{
    $params['type'] = 'checkbox';
    if (array_key_exists('checked', $params)) {
        if ($params['checked']) {
            $params['checked'] = 'checked';
        } else {
            unset($params['checked']);
        }
        // if
    }
    // if
    $class = array_var($params, 'class');
    if ($class == '') {
        $classes[] = 'inline';
        $classes[] = 'input_checkbox';
    } else {
        $classes = explode(' ', $class);
        if (!in_array('inline', $classes)) {
            $classes[] = 'inline';
        }
        // if
        $classes[] = 'input_checkbox';
    }
    // if
    $params['class'] = implode(' ', $classes);
    if (!isset($params['value'])) {
        $params['value'] = '1';
    }
    // if
    return open_html_tag('input', $params, true);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:46,代码来源:function.checkbox_field.php

示例4: smarty_function_object_visibility

/**
 * Show object visibility if it's private
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_visibility($params, &$smarty)
{
    static $ids = array();
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is not valid instance of ProjectObject class', true);
    }
    // if
    if ($object->getVisibility() > VISIBILITY_PRIVATE) {
        return '';
    }
    // if
    $user = array_var($params, 'user');
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('user', $user, '$user is expected to be an instance of User class', true);
    }
    // if
    if (!$user->canSeePrivate()) {
        return '';
    }
    // if
    $id = array_var($params, 'id');
    if (empty($id)) {
        do {
            $id = 'object_visibility_' . make_string(40);
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    return open_html_tag('a', array('href' => assemble_url('project_object_visibility', array('project_id' => $object->getProjectId(), 'object_id' => $object->getId())), 'title' => lang('Private :type', array('type' => Inflector::humanize($object->getType()))), 'class' => 'object_visibility', 'id' => $id)) . '<img src="' . get_image_url('private.gif') . '" alt="" /></a><script type="text/javascript">App.widgets.ObjectVisibility.init("' . $id . '");</script>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:38,代码来源:function.object_visibility.php

示例5: smarty_function_with_successive_milestones

/**
 * with_successive_milestones helper
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_with_successive_milestones($params, &$smarty)
{
    static $counter = 1;
    $name = array_var($params, 'name');
    if (empty($name)) {
        return new InvalidParamError('name', $name, '$name value is required', true);
    }
    // if
    $milestone = array_var($params, 'milestone');
    if (!instance_of($milestone, 'Milestone')) {
        return new InvalidParamError('milestone', $milestone, '$milestone value is expected to be an instance of Milestone class', true);
    }
    // if
    $id = array_var($params, 'id');
    if (empty($id)) {
        $id = 'with_successive_milestones_' . $counter;
        $counter++;
    }
    // if
    $value = array_var($params, 'value');
    $action = array_var($value, 'action', 'dont_move');
    $milestones = array_var($value, 'milestones');
    if (!is_array($milestones)) {
        $milestones = array();
    }
    // if
    $logged_user = $smarty->get_template_vars('logged_user');
    $successive_milestones = Milestones::findSuccessiveByMilestone($milestone, STATE_VISIBLE, $logged_user->getVisibility());
    if (!is_foreachable($successive_milestones)) {
        return '<p class="details">' . lang('This milestone does not have any successive milestones') . '</p>';
    }
    // if
    $result = "<div class=\"with_successive_milestones\">\n<div class=\"options\">\n";
    $options = array('dont_move' => lang("Don't change anything"), 'move_all' => lang('Adjust all successive milestone by the same number of days'), 'move_selected' => lang('Adjust only selected successive milestones by the same number of days'));
    foreach ($options as $k => $v) {
        $radio = radio_field($name . '[action]', $k == $action, array('value' => $k, 'id' => $id . '_' . $k));
        $label = label_tag($v, $id . '_' . $k, false, array('class' => 'inline'), '');
        $result .= '<span class="block">' . $radio . ' ' . $label . "</span>\n";
    }
    // if
    $result .= "</div>\n<div class=\"successive_milestones\">";
    foreach ($successive_milestones as $successive_milestone) {
        $input_attributes = array('name' => $name . '[milestones][]', 'id' => $id . '_milestones_' . $successive_milestone->getId(), 'type' => 'checkbox', 'value' => $successive_milestone->getId(), 'class' => 'auto');
        if (in_array($successive_milestone->getId(), $milestones)) {
            $input_attributes['checked'] = true;
        }
        // if
        $input = open_html_tag('input', $input_attributes, true);
        $label = label_tag($successive_milestone->getName(), $id . '_milestones_' . $successive_milestone->getId(), false, array('class' => 'inline'), '');
        $result .= '<span class="block">' . $input . ' ' . $label . "</span>\n";
    }
    // foreach
    $result .= "</div>\n</div>\n";
    return $result;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:62,代码来源:function.with_successive_milestones.php

示例6: smarty_block_link

/**
 * Render button
 * 
 * Parameters:
 * 
 * - common anchor parameter
 * 
 * - method - if POST that this button will be send POST request. Method works 
 *   only if href parameter is present
 * - confirm - enforces confirmation dialog
 *   codes
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_link($params, $content, &$smarty, &$repeat)
{
    $href = '';
    if (isset($params['href'])) {
        $href = $params['href'];
        if (str_starts_with($href, '?')) {
            $href = assemble_from_string($params['href']);
        }
        // if
    }
    // if
    $params['href'] = $href;
    $confirm = '';
    if (array_key_exists('confirm', $params)) {
        $confirm = lang(trim($params['confirm']));
        unset($params['confirm']);
    }
    // if
    $post = false;
    if (array_key_exists('method', $params)) {
        if (strtolower($params['method']) == 'post') {
            $post = true;
        }
        // if
        unset($params['method']);
    }
    // if
    if ($post || $confirm) {
        $execution = $post ? 'App.postLink(' . var_export($href, true) . ')' : 'location.href = ' . var_export($href, true);
        if ($confirm) {
            $params['onclick'] = "if(confirm(" . var_export($confirm, true) . ")) { {$execution}; } return false;";
        } else {
            $params['onclick'] = "{$execution}; return false;";
        }
        // if
    }
    // if
    $not_lang = false;
    if (isset($params['not_lang'])) {
        $not_lang = (bool) $params['not_lang'];
        unset($params['not_lang']);
    }
    // if
    if (array_key_exists('id', $params) && strlen($params['id']) == 0) {
        unset($params['id']);
    }
    // if
    if (array_key_exists('title', $params)) {
        $params['title'] = lang($params['title']);
    }
    // if
    $text = $not_lang ? $content : lang($content);
    return open_html_tag('a', $params) . $text . '</a>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:72,代码来源:block.link.php

示例7: smarty_function_text_field

/**
 * Render input text
 * 
 * Parameters:
 * 
 * - name - field name
 * - value - initial value
 * - array of additional attributes
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_text_field($params, &$smarty)
{
    $type = 'text';
    if (!empty($params['type'])) {
        $type = array_var($params, 'type');
        unset($params['type']);
    }
    // if
    $params['type'] = $type;
    return open_html_tag('input', $params, true);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:24,代码来源:function.text_field.php

示例8: smarty_function_select_tags

/**
 * Render select tags control
 * 
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_tags($params, &$smarty)
{
    $value = array_var($params, 'value', null, true);
    if (is_array($value)) {
        $value = implode(', ', $value);
    }
    // if
    $params['type'] = 'text';
    $params['value'] = $value;
    return open_html_tag('input', $params, true);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:18,代码来源:function.select_tags.php

示例9: smarty_function_project_group_link

/**
 * Render project group link
 * 
 * Parameters:
 * 
 * - group - ProjectGroup
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_project_group_link($params, &$smarty)
{
    $group = array_var($params, 'group');
    if (!instance_of($group, 'ProjectGroup')) {
        return new InvalidParamError('group', $group, '$group is expected to be an instance of ProjectGroup class', true);
    }
    // if
    unset($params['group']);
    $params['href'] = $group->getViewUrl();
    return open_html_tag('a', $params) . clean($group->getName()) . '</a>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:22,代码来源:function.project_group_link.php

示例10: render_icon

 /**
 * Render icon IMG tag
 *
 * @access public
 * @param string $filename Icon filename
 * @param string $alt Value of alt attrbute for IMG
 * @param array $attributes Array of additional attributes
 * @return string
 */
 function render_icon($filename, $alt = '', $attributes = null) {
   if(is_array($attributes)) {
     $attributes['src'] = icon_url($filename);
     $attributes['alt'] = $alt;
   } else {
     $attributes = array(
       'src' => icon_url($filename),
       'alt' => $alt
     ); // array
   } // if
   return open_html_tag('img', $attributes, true);
 } // render_icon
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:21,代码来源:common.php

示例11: smarty_block_textarea_field

/**
 * Render textarea
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_textarea_field($params, $content, &$smarty, &$repeat)
{
    if (!isset($params['rows'])) {
        $params['rows'] = 10;
    }
    // if
    if (!isset($params['cols'])) {
        $params['cols'] = 48;
    }
    // if
    return open_html_tag('textarea', $params) . clean($content) . '</textarea>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:21,代码来源:block.textarea_field.php

示例12: smarty_function_image

/**
 * Generate image tag based on properties (same as for image_url)
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_image($params, &$smarty)
{
    require_once SMARTY_PATH . '/plugins/function.image_url.php';
    $name = array_var($params, 'name', null, true);
    $module = array_var($params, 'module', null, true);
    $params['src'] = smarty_function_image_url(array('name' => $name, 'module' => $module), $smarty);
    if (!isset($params['alt'])) {
        $params['alt'] = '';
    }
    // if
    return open_html_tag('img', $params, true);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:19,代码来源:function.image.php

示例13: smarty_block_button

/**
 * Render button
 * 
 * Parameters:
 * 
 * - common button parameter
 * - href - when button is clicked this link is opened
 * - method - if POST that this button will be send POST request. Method works 
 *   only if href parameter is present
 * - confirm - enforces confirmation dialog
 * - not_lang - if true content will not be matched agains registered language 
 *   codes
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return string
 */
function smarty_block_button($params, $content, &$smarty, &$repeat)
{
    if (!isset($params['type'])) {
        $params['type'] = 'button';
    }
    // if
    $href = '';
    if (isset($params['href'])) {
        $href = $params['href'];
        if (str_starts_with($href, '?')) {
            $href = assemble_from_string($params['href']);
        }
        // if
        unset($params['href']);
    }
    // if
    $confirm = '';
    if (isset($params['confirm'])) {
        $confirm = trim($params['confirm']);
        unset($params['confirm']);
    }
    // if
    $post = false;
    if (isset($params['method'])) {
        $post = strtolower($params['method']) == 'post';
        unset($params['method']);
    }
    // if
    if ($href) {
        $execution = $post ? 'App.postLink(' . var_export($href, true) . ')' : 'location.href = ' . var_export($href, true);
        if ($confirm) {
            $params['onclick'] = "if(confirm(" . var_export($confirm, true) . ")) { {$execution}; } return false;";
        } else {
            $params['onclick'] = "{$execution}; return false;";
        }
        // if
    } else {
        if ($confirm) {
            $params['onclick'] = "return confirm(" . var_export($confirm, true) . ")";
        }
        // if
    }
    // if
    $not_lang = false;
    if (isset($params['not_lang'])) {
        $not_lang = (bool) $params['not_lang'];
        unset($params['not_lang']);
    }
    // if
    $text = $not_lang ? $content : lang($content);
    return open_html_tag('button', $params) . '<span><span>' . clean($text) . '</span></span></button>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:71,代码来源:block.button.php

示例14: smarty_block_wrap

/**
 * Wrap form field into a DIV
 * 
 * Properties:
 * 
 * - field - field name
 * - errors - errors container (ValidationErrors instance)
 * - show_errors - show errors list inside of field wrapper
 *
 * @param array $params
 * @param string $content
 * @param Smarty $smarty
 * @param boolean $repeat
 * @return null
 */
function smarty_block_wrap($params, $content, &$smarty, &$repeat)
{
    $field = array_var($params, 'field');
    if (empty($field)) {
        return new InvalidParamError('field', $field, "'field' property is required for 'wrap_field' helper", true);
    }
    // if
    $classes = array();
    if (isset($params['class'])) {
        $classes = explode(' ', $params['class']);
        unset($params['class']);
    }
    // if
    if (!in_array('ctrlHolder', $classes)) {
        $classes[] = 'ctrlHolder';
    }
    // if
    $error_messages = null;
    if (isset($params['errors'])) {
        $errors = $params['errors'];
    } else {
        $errors = $smarty->get_template_vars('errors');
    }
    // if
    if (instance_of($errors, 'ValidationErrors')) {
        if ($errors->hasError($field)) {
            $classes[] = 'error';
            $error_messages = $errors->getFieldErrors($field);
        }
        // if
    }
    // if
    $show_errors = array_var($params, 'show_errors', true);
    $listed_errors = '';
    if (is_foreachable($error_messages) && $show_errors) {
        require_once $smarty->_get_plugin_filepath('function', 'field_errors');
        $listed_errors = smarty_function_field_errors(array('field' => $field, 'errors' => $errors), $smarty);
    }
    // if
    $aid = array_var($params, 'aid');
    if ($aid) {
        $aid = '<p class="aid">' . clean(lang($aid)) . '</p>';
    }
    // if
    // Unset helper properties, we need this for attributes
    unset($params['field']);
    unset($params['errors']);
    unset($params['show_errors']);
    unset($params['aid']);
    $params['class'] = implode(' ', $classes);
    return open_html_tag('div', $params) . "\n{$listed_errors}\n" . $content . $aid . "\n</div>";
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:67,代码来源:block.wrap.php

示例15: smarty_function_invoice_link

/**
 * Display invoice link
 * 
 * Params:
 * 
 * - invoice
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_invoice_link($params, &$smarty)
{
    $invoice = array_var($params, 'invoice', null, true);
    if (!instance_of($invoice, 'Invoice')) {
        return new InvalidParamError('invoice', $invoice, '$invoice is expected to be an instance of Invoice class', true);
    }
    // if
    if (array_var($params, 'company')) {
        $params['href'] = $invoice->getCompanyViewUrl();
    } else {
        $params['href'] = $invoice->getViewUrl();
    }
    // if
    return open_html_tag('a', $params) . clean($invoice->getName()) . '</a>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:26,代码来源:function.invoice_link.php


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