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


PHP smarty_function_icon函数代码示例

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


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

示例1: smarty_function_show_sort

function smarty_function_show_sort($params, $smarty)
{
    global $url_path;
    if (isset($_REQUEST[$params['sort']])) {
        $p = $_REQUEST[$params['sort']];
    } elseif ($s = $smarty->getTemplateVars($params['sort'])) {
        $p = $s;
    }
    if (isset($params['sort']) and isset($params['var']) and isset($p)) {
        $prop = substr($p, 0, strrpos($p, '_'));
        $order = substr($p, strrpos($p, '_') + 1);
        if (strtolower($prop) == strtolower(trim($params['var']))) {
            $smarty->loadPlugin('smarty_function_icon');
            $icon_params = array('alt' => tra('Invert Sort'), 'style' => 'vertical-align:middle');
            switch ($order) {
                case 'asc':
                case 'nasc':
                    $icon_params['_id'] = 'resultset_up';
                    return smarty_function_icon($icon_params, $smarty);
                    break;
                case 'desc':
                case 'ndesc':
                    $icon_params['_id'] = 'resultset_down';
                    return smarty_function_icon($icon_params, $smarty);
                    break;
            }
        }
    }
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:29,代码来源:function.show_sort.php

示例2: smarty_modifier_iconify

/**
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     modifier
 * Name:     iconify
 * Purpose:  Returns a filetype icon if the filetype is known and there's an icon in img/icons/mime. Returns a default file type icon in any other case
 * -------------------------------------------------------------
 */
function smarty_modifier_iconify($string, $filetype = null)
{
    global $smarty;
    $smarty->loadPlugin('smarty_function_icon');
    $icon = '';
    $ext = strtolower(substr($string, strrpos($string, '.') + 1));
    if (file_exists("img/icons/mime/{$ext}.png")) {
        $icon = $ext;
    } elseif (file_exists('img/icons/mime/' . substr($ext, 0, 3) . '.png')) {
        $icon = substr($ext, 0, 3);
    } else {
        include_once 'lib/mime/mimetypes.php';
        global $mimetypes;
        $mimes = array_keys($mimetypes, $filetype);
        foreach ($mimes as $m) {
            if (file_exists("img/icons/mime/{$m}.png")) {
                $icon = $m;
            }
        }
        if (empty($icon)) {
            $icon = 'default';
        }
    }
    return smarty_function_icon(array('_id' => 'img/icons/mime/' . $icon . '.png', 'alt' => $filetype === null ? $icon : $filetype, 'class' => ''), $smarty);
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:33,代码来源:modifier.iconify.php

示例3: smarty_block_title

function smarty_block_title($params, $content, &$smarty, $repeat)
{
    global $prefs;
    global $smarty;
    global $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin;
    if ($repeat || $content == '') {
        return;
    }
    if (!isset($params['help'])) {
        $params['help'] = '';
    }
    if (!isset($params['admpage'])) {
        $params['admpage'] = '';
    }
    if (!isset($params['url'])) {
        $params['url'] = $_SERVER['REQUEST_URI'];
    }
    $html = '<h1>';
    $html .= '<a class="pagetitle" href="' . $params['url'] . '">' . $content . "</a>\n";
    if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') {
        $html .= '<a href="' . $prefs['helpurl'] . $params['help'] . '" target="tikihelp" class="tikihelp" title="' . tra('Help page:') . ' ' . $content . '">' . smarty_function_icon(array('_id' => 'help'), $smarty) . "</a>\n";
    }
    if ($prefs['feature_view_tpl'] == 'y' && ($tiki_p_edit_templates || $tiki_p_edit_templates)) {
        $html .= '<a href="tiki-edit_templates.php?template=' . $smarty->_tpl_vars['mid'] . '" target="tikihelp" class="tikihelp" title="' . tra('View tpl:') . ' ' . $content . '">' . smarty_function_icon(array('_id' => 'shape_square_edit', 'alt' => tra('Edit Template')), $smarty) . "</a>\n";
    }
    if ($tiki_p_admin == 'y' && $params['admpage'] != '') {
        $html .= '<a href="tiki-admin.php?page=' . $params['admpage'] . '">' . smarty_function_icon(array('_id' => 'wrench', 'alt' => tra('Admin Feature')), $smarty) . "</a>\n";
    }
    $html .= '</h1>';
    return $html;
}
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:block.title.php

示例4: smarty_modifier_iconify

function smarty_modifier_iconify($string, $filetype = null)
{
    global $smarty;
    $ext = strtolower(substr($string, strrpos($string, '.') + 1));
    $icon = file_exists("pics/icons/mime/{$ext}.png") ? $ext : 'default';
    return smarty_function_icon(array('_id' => 'pics/icons/mime/' . $icon . '.png', 'alt' => $filetype === null ? $icon : $filetype, 'class' => ''), $smarty);
}
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:7,代码来源:modifier.iconify.php

示例5: wikiplugin_article

function wikiplugin_article($data, $params)
{
    global $user, $tiki_p_admin_cms;
    $userlib = TikiLib::lib('user');
    $tikilib = TikiLib::lib('tiki');
    $statslib = TikiLib::lib('stats');
    $artlib = TikiLib::lib('art');
    $smarty = TikiLib::lib('smarty');
    extract($params, EXTR_SKIP);
    if (empty($Id)) {
        $Id = $artlib->get_most_recent_article_id();
    }
    if (!isset($Field)) {
        $Field = 'heading';
    }
    if ($tiki_p_admin_cms == 'y' || $tikilib->user_has_perm_on_object($user, $Id, 'article', 'tiki_p_edit_article') || isset($article_data) && $article_data["author"] == $user && $article_data["creator_edit"] == 'y') {
        $smarty->loadPlugin('smarty_function_icon');
        $add = "&nbsp;<a href='tiki-edit_article.php?articleId={$Id}' class='editplugin'>" . smarty_function_icon(['name' => 'edit'], $smarty) . '</a>';
    } else {
        $add = "";
    }
    $article_data = $artlib->get_article($Id);
    if (isset($article_data[$Field])) {
        return $tikilib->parse_data($article_data[$Field]) . $add;
    }
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:26,代码来源:wikiplugin_article.php

示例6: smarty_function_js_insert_icon

/**
 * Function to load jQuery code to insert an iconset icon into an element
 * Useful for when there's no other way to make 3rd party code consistent with the Tiki iconsets
 *
 * type     - determines the js string that will be returned
 * iconname - set the icon to override the default
 * return   - return the js code rather than add to the header
 * @param $params
 * @param $smarty
 * @return string
 * @throws Exception
 */
function smarty_function_js_insert_icon($params, $smarty)
{
    if (!empty($params['type'])) {
        //set icon
        $iconmap = ['jscalendar' => 'calendar'];
        $iconname = !empty($params['iconname']) ? $params['iconname'] : $iconmap[$params['type']];
        $smarty->loadPlugin('smarty_function_icon');
        $icon = smarty_function_icon(['name' => $iconname], $smarty);
        //set js
        switch ($params['type']) {
            case 'jscalendar':
                $js = "\$('div.jscal > button.ui-datepicker-trigger').empty().append('{$icon}').addClass('btn btn-sm btn-link').css({'padding' : '0px', 'font-size': '16px'});";
                break;
        }
        //load js
        if (!empty($js)) {
            if (isset($params['return']) && $params['return'] === 'y') {
                return $js;
            } else {
                $headerlib = TikiLib::lib('header');
                $headerlib->add_jq_onready($js);
            }
        }
    }
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:37,代码来源:function.js_insert_icon.php

示例7: smarty_block_title

function smarty_block_title($params, $content, $template, &$repeat)
{
    global $prefs, $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin;
    if ($repeat || empty($content)) {
        return;
    }
    $template->loadPlugin('smarty_function_icon');
    $template->loadPlugin('smarty_modifier_sefurl');
    $template->loadPlugin('smarty_modifier_escape');
    if (!isset($params['help'])) {
        $params['help'] = '';
    }
    if (!isset($params['admpage'])) {
        $params['admpage'] = '';
    }
    if (!isset($params['actions'])) {
        $params['actions'] = '';
    }
    // Set the variable for the HTML title tag
    $template->smarty->assign('headtitle', $content);
    $class = '';
    $current = current_object();
    if (!isset($params['url'])) {
        $params['url'] = smarty_modifier_sefurl($current['object'], $current['type']);
    }
    $metadata = '';
    $coordinates = TikiLib::lib('geo')->get_coordinates($current['type'], $current['object']);
    if ($coordinates) {
        $class = ' geolocated primary';
        $metadata = " data-geo-lat=\"{$coordinates['lat']}\" data-geo-lon=\"{$coordinates['lon']}\"";
        if (isset($coordinates['zoom'])) {
            $metadata .= " data-geo-zoom=\"{$coordinates['zoom']}\"";
        }
    }
    $html = '<h1 class="pagetitle">';
    $html .= '<a class="' . $class . '"' . $metadata . ' href="' . $params['url'] . '">' . smarty_modifier_escape($content) . "</a>\n";
    if ($template->getTemplateVars('print_page') != 'y') {
        if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') {
            $html .= '<a href="';
            $html .= $prefs['helpurl'] . rawurlencode($params['help']) . '" class="tips btn btn-link" title="' . smarty_modifier_escape($content) . '|' . tra('Help page') . '" target="tikihelp">' . smarty_function_icon(array('name' => 'help'), $template) . "</a>\n";
        }
        if ($prefs['feature_edit_templates'] == 'y' && $tiki_p_edit_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=';
            $html .= $tpl . '" class="tips btn btn-link" title="' . tra('View or edit tpl') . '|' . htmlspecialchars($content) . '">' . smarty_function_icon(array('name' => 'edit'), $template) . "</a>\n";
        } elseif ($prefs['feature_view_tpl'] == 'y' && $tiki_p_view_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=';
            $html .= $tpl . '" class="tips btn btn-link" title="' . tra('View tpl') . '|' . htmlspecialchars($content) . '">' . smarty_function_icon(array('name' => 'view'), $template) . "</a>\n";
        }
        if ($tiki_p_admin == 'y' && $params['admpage'] != '') {
            $html .= '<a class="tips btn btn-link" href="tiki-admin.php?page=';
            $html .= $params['admpage'] . '" title="' . htmlspecialchars($content) . '|' . tra('Settings') . '">' . smarty_function_icon(array('name' => 'settings'), $template) . "</a>\n";
        }
        if ($params['actions'] != '') {
            $html .= $params['actions'];
        }
    }
    $html .= '</h1>';
    return $html;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:59,代码来源:block.title.php

示例8: smarty_block_title

function smarty_block_title($params, $content, $template, &$repeat)
{
    global $prefs, $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin;
    if ($repeat || empty($content)) {
        return;
    }
    $template->loadPlugin('smarty_function_icon');
    if (!isset($params['help'])) {
        $params['help'] = '';
    }
    if (!isset($params['admpage'])) {
        $params['admpage'] = '';
    }
    if (!isset($params['url'])) {
        $template->loadPlugin('smarty_function_query');
        $params['url'] = htmlspecialchars(smarty_function_query(array('_type' => 'absolute_path'), $template));
        $params['url'] = str_replace('&amp;amp;', '&', $params['url']);
    }
    // Set the variable for the HTML title tag
    $template->smarty->assign('headtitle', $content);
    $class = 'pagetitle';
    $current = current_object();
    $metadata = '';
    $coordinates = TikiLib::lib('geo')->get_coordinates($current['type'], $current['object']);
    if ($coordinates) {
        $class = ' geolocated primary';
        $metadata = " data-geo-lat=\"{$coordinates['lat']}\" data-geo-lon=\"{$coordinates['lon']}\"";
        if (isset($coordinates['zoom'])) {
            $metadata .= " data-geo-zoom=\"{$coordinates['zoom']}\"";
        }
    }
    $html = '<h1>';
    $html .= '<a class="' . $class . '"' . $metadata . ' href="' . $params['url'] . '">' . htmlspecialchars($content) . "</a>\n";
    if ($template->getTemplateVars('print_page') != 'y') {
        if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') {
            $html .= '<a href="' . $prefs['helpurl'] . rawurlencode($params['help']) . '" class="titletips" title="' . tra('Help page:') . ' ' . htmlspecialchars($content) . '" target="tikihelp">' . smarty_function_icon(array('_id' => 'help'), $template) . "</a>\n";
        }
        if ($prefs['feature_edit_templates'] == 'y' && $tiki_p_edit_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=' . $tpl . '" class="titletips" title="' . tra('View or edit tpl:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'shape_square_edit', 'alt' => tra('Edit Template')), $template) . "</a>\n";
        } elseif ($prefs['feature_view_tpl'] == 'y' && $tiki_p_view_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=' . $tpl . '" class="titletips" title="' . tra('View tpl:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'shape_square', 'alt' => tra('View Template')), $template) . "</a>\n";
        }
        if ($tiki_p_admin == 'y' && $params['admpage'] != '') {
            $html .= '<a class="titletips" href="tiki-admin.php?page=' . $params['admpage'] . '" title="' . tra('Admin page:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'wrench', 'alt' => tra('Admin Feature')), $template) . "</a>\n";
        }
    }
    $html .= '</h1>';
    return $html;
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:49,代码来源:block.title.php

示例9: __construct

 function __construct(&$parser)
 {
     global $smarty, $prefs;
     $this->parser =& $parser;
     if ($prefs['popupLinks'] == 'y') {
         $this->attr .= 'target="_blank" ';
     }
     if ($prefs['feature_wiki_ext_icon'] == 'y') {
         $this->attr .= 'class="wiki external" ';
         include_once 'lib/smarty_tiki/function.icon.php';
         $this->icon = smarty_function_icon(array('_id' => 'external_link', 'alt' => tra('(external link)'), '_class' => 'externallink', '_extension' => 'gif', '_defaultdir' => 'img/icons', 'width' => 15, 'height' => 14), $smarty);
     } else {
         $this->attr .= 'class="wiki" ';
     }
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:15,代码来源:AutoLink.php

示例10: button

 function button($wiki_edit_icons_toggle)
 {
     global $smarty;
     if ($wiki_edit_icons_toggle == 'y' && !isset($_COOKIE['wiki_plugin_edit_view'])) {
         $iconDisplayStyle = ' style="display:none;"';
     } else {
         $iconDisplayStyle = '';
     }
     $button = '<div class="icon_edit_section"' . $iconDisplayStyle . '><a href="tiki-editpage.php?';
     if (!empty($_REQUEST['page'])) {
         $button .= 'page=' . urlencode($_REQUEST['page']) . '&amp;';
     }
     $this->count++;
     include_once 'lib/smarty_tiki/function.icon.php';
     $button .= 'hdr=' . $this->count . '">' . smarty_function_icon(array('_id' => 'page_edit_section', 'alt' => tra('Edit Section')), $smarty) . '</a></div>';
     return $button;
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:17,代码来源:Header.php

示例11: smarty_modifier_avatarize

function smarty_modifier_avatarize($user, $float = '', $default = '', $show_tag = 'y')
{
    if (!$user) {
        return '';
    }
    $avatar = TikiLib::lib('tiki')->get_user_avatar($user, $float);
    if (!$avatar && $default) {
        $smarty = TikiLib::lib('smarty');
        $smarty->loadPlugin('smarty_function_icon');
        $name = TikiLib::lib('user')->clean_user($user);
        $avatar = smarty_function_icon(['_id' => $default, 'title' => $name], $smarty);
    }
    if ($avatar != '' && $show_tag == 'y') {
        $avatar = TikiLib::lib('user')->build_userinfo_tag($user, $avatar);
    }
    return $avatar;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:17,代码来源:modifier.avatarize.php

示例12: render

 function render($name, $value, array $entry)
 {
     if ($name === 'tracker_status') {
         switch ($value) {
             case 'o':
                 $status = 'open';
                 break;
             case 'p':
                 $status = 'pending';
                 break;
             default:
             case 'c':
                 $status = 'closed';
                 break;
         }
         $smarty = TikiLib::lib('smarty');
         $smarty->loadPlugin('smarty_function_icon');
         return smarty_function_icon(['name' => 'status-' . $status, 'iclass' => 'tips', 'ititle' => ':' . ucfirst($status)], $smarty);
     } elseif (substr($name, 0, 14) !== 'tracker_field_') {
         return $value;
     }
     $tracker = Tracker_Definition::get($entry['tracker_id']);
     if (!is_object($tracker)) {
         return $value;
     }
     $field = $tracker->getField(substr($name, 14));
     // TextArea fields need the raw wiki syntax here for it to get wiki parsed if necessary
     if ($field['type'] === 'a' && isset($entry[$name . '_raw'])) {
         $value = $entry[$name . '_raw'];
     }
     $field['value'] = $value;
     $this->cancache = !in_array($field['type'], array('STARS', 's'));
     // don't cache ratings fields
     if ($this->editable) {
         // Caching breaks inline editing
         $this->cancache = false;
     }
     $item = array();
     if ($entry['object_type'] == 'trackeritem') {
         $item['itemId'] = $entry['object_id'];
     }
     $trklib = TikiLib::lib('trk');
     $rendered = $trklib->field_render_value(array('item' => $item, 'field' => $field, 'process' => 'y', 'search_render' => 'y', 'list_mode' => $this->list_mode, 'editable' => $this->editable, 'editgroup' => $this->group));
     return '~np~' . $rendered . '~/np~';
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:45,代码来源:Trackerrender.php

示例13: renderInnerOutput

 function renderInnerOutput($context = array())
 {
     $att_id = $this->getValue();
     if (empty($att_id)) {
         return '';
     }
     if ($context['list_mode'] === 'csv') {
         global $base_url;
         return $base_url . 'tiki-download_item_attachment.php?attId=' . $att_id;
         // should something to do with export_attachment() happen here?
     }
     $attachment = TikiLib::lib('trk')->get_item_attachment($att_id);
     $smarty = TikiLib::lib('smarty');
     $smarty->loadPlugin('smarty_block_self_link');
     $smarty->loadPlugin('smarty_function_icon');
     $link = smarty_block_self_link(array('_script' => 'tiki-download_item_attachment.php', 'attId' => $att_id), smarty_function_icon(array('_id' => 'disk', 'alt' => tra('Download')), $smarty) . ' ' . $attachment['filename'], $smarty);
     return $link;
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:18,代码来源:File.php

示例14: smarty_block_add_help

function smarty_block_add_help($params, $content, $smarty, &$repeat)
{
    global $prefs;
    global $help_sections;
    if (!isset($content)) {
        return;
    }
    if ($prefs['javascript_enabled'] != 'y') {
        return $content;
    }
    if (isset($params['title'])) {
        $section['title'] = $params['title'];
    }
    if (isset($params['id'])) {
        $section['id'] = $params['id'];
    } else {
        $section['id'] = $params['id'] = 'help_section_' . count($help_sections);
    }
    $section['content'] = $content;
    $help_sections[$params['id']] = $section;
    if (!isset($params['show']) or $params['show'] == 'y') {
        $smarty->loadPlugin('smarty_block_self_link');
        $smarty->loadPlugin('smarty_function_icon');
        $self_link_params['_alt'] = tra('Click for Help');
        $self_link_params['_ajax'] = 'n';
        $self_link_params['_anchor'] = $section['id'];
        $self_link_params['_title'] = $section['title'];
        $self_link_params['_class'] = 'help';
        $self_link_params['_onclick'] = '$.openEditHelp(' . (count($help_sections) - 1) . ');return false;';
        $link = '';
        if (empty($params['icononly']) || $params['icononly'] === 'n') {
            $link = $section['title'] . '&nbsp;';
        }
        $link .= smarty_function_icon(array('_id' => 'help'), $smarty);
        return smarty_block_self_link($self_link_params, $link, $smarty);
    } else {
        return;
    }
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:39,代码来源:block.add_help.php

示例15: help_doclink

function help_doclink($params)
{
    global $prefs;
    extract($params);
    // Param = zone
    $ret = '';
    if (empty($url) && empty($desc) && empty($crumb)) {
        return;
    }
    if (!empty($crumb)) {
        $url = $crumb->helpUrl;
        $desc = $crumb->helpDescription;
    }
    if ($prefs['feature_help'] == 'y' and $url) {
        if (!isset($desc)) {
            $smarty = TikiLib::lib('smarty');
            $smarty->loadPlugin('smarty_function_icon');
            $desc = tra('Help link');
            $ret = '<a title="' . $url . '|' . htmlentities($desc, ENT_COMPAT, 'UTF-8') . '" href="' . $prefs['helpurl'] . $url . '" target="tikihelp" class="tikihelp btn btn-link">' . smarty_function_icon(array('name' => 'help'), $smarty) . '</a>';
        }
    }
    return $ret;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:23,代码来源:tikihelplib.php


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