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


PHP DataUtil::formatForDisplayHTML方法代码示例

本文整理汇总了PHP中DataUtil::formatForDisplayHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP DataUtil::formatForDisplayHTML方法的具体用法?PHP DataUtil::formatForDisplayHTML怎么用?PHP DataUtil::formatForDisplayHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataUtil的用法示例。


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

示例1: smarty_function_manuallink

/**
 * Zikula_View function to create  manual link.
 *
 * This function creates a manual link from some parameters.
 *
 * Available parameters:
 *   - manual:    name of manual file, manual.html if not set
 *   - chapter:   an anchor in the manual file to jump to
 *   - newwindow: opens the manual in a new window using javascript
 *   - width:     width of the window if newwindow is set, default 600
 *   - height:    height of the window if newwindow is set, default 400
 *   - title:     name of the new window if newwindow is set, default is modulename
 *   - class:     class for use in the <a> tag
 *   - assign:    if set, the results ( array('url', 'link') are assigned to the corresponding variable instead of printed out
 *
 * Example
 * {manuallink newwindow=1 width=400 height=300 title=rtfm }
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string|void
 */
function smarty_function_manuallink($params, Zikula_View $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('manuallink')), E_USER_DEPRECATED);
    $userlang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
    $stdlang = System::getVar('language_i18n');
    $title = isset($params['title']) ? $params['title'] : 'Manual';
    $manual = isset($params['manual']) ? $params['manual'] : 'manual.html';
    $chapter = isset($params['chapter']) ? '#' . $params['chapter'] : '';
    $class = isset($params['class']) ? 'class="' . $params['class'] . '"' : '';
    $width = isset($params['width']) ? $params['width'] : 600;
    $height = isset($params['height']) ? $params['height'] : 400;
    $modname = ModUtil::getName();
    $possibleplaces = array("modules/{$modname}/docs/{$userlang}/manual/{$manual}", "modules/{$modname}/docs/{$stdlang}/manual/{$manual}", "modules/{$modname}/docs/en/manual/{$manual}", "modules/{$modname}/docs/{$userlang}/{$manual}", "modules/{$modname}/docs/{$stdlang}/{$manual}", "modules/{$modname}/docs/lang/en/{$manual}");
    foreach ($possibleplaces as $possibleplace) {
        if (file_exists($possibleplace)) {
            $url = $possibleplace . $chapter;
            break;
        }
    }
    if (isset($params['newwindow'])) {
        $link = "<a {$class} href='#' onclick=\"window.open( '" . DataUtil::formatForDisplay($url) . "' , '" . DataUtil::formatForDisplay($modname) . "', 'status=yes,scrollbars=yes,resizable=yes,width={$width},height={$height}'); picwin.focus();\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    } else {
        $link = "<a {$class} href=\"" . DataUtil::formatForDisplay($url) . "\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    }
    if (isset($params['assign'])) {
        $ret = array('url' => $url, 'link' => $link);
        $view->assign($params['assign'], $ret);
        return;
    } else {
        return $link;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:55,代码来源:function.manuallink.php

示例2: smarty_function_configgetvar

/**
 * Obtain and display a configuration variable from the Zikula system.
 *
 * Available attributes:
 *  - name      (string)    The name of the configuration variable to obtain
 *  - html      (bool)      If set, the output is prepared for display by
 *                          DataUtil::formatForDisplayHTML instead of
 *                          DataUtil::formatForDisplay
 *  - assign    (string)    the name of a template variable to assign the
 *                          output to, instead of returning it to the template. (optional)
 *
 * <i>Note that if the the result is assigned to a template variable, it is not
 * prepared for display by either DataUtil::formatForDisplayHTML or
 * DataUtil::formatForDisplay. If it is to be displayed, the safetext
 * modifier should be used.</i>
 *
 * Examples:
 *
 * <samp><p>Welcome to {configgetvar name='sitename'}!</p></samp>
 *
 * <samp>{configgetvar name='sitename' assign='thename'}</samp><br>
 * <samp><p>Welcome to {$thename|safetext}!</p></samp>
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the {@link Zikula_View} object.
 *
 * @return mixed The value of the configuration variable.
 */
function smarty_function_configgetvar($params, $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('configgetvar')), E_USER_DEPRECATED);

    $name      = isset($params['name'])    ? $params['name']    : null;
    $default   = isset($params['default']) ? $params['default'] : null;
    $html      = isset($params['html'])    ? $params['html']    : null;
    $assign    = isset($params['assign'])  ? $params['assign']  : null;

    if (!$name) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('configgetvar', 'name')));
        return false;
    }

    $result = System::getVar($name, $default);

    if ($assign) {
        $view->assign($assign, $result);
    } else {
        if (is_bool($html) && $html) {
            return DataUtil::formatForDisplayHTML($result);
        } else {
            return DataUtil::formatForDisplay($result);
        }
    }
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例3: smarty_function_modgetvar

/**
 * Zikula_View function to get module variable
 *
 * This function obtains a module-specific variable from the Zikula system.
 *
 * Note that the results should be handled by the safetext or the safehtml
 * modifier before being displayed.
 *
 *
 * Available parameters:
 *   - module:   The well-known name of a module from which to obtain the variable
 *   - name:     The name of the module variable to obtain
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - html:     If true then result will be treated as html content
 *   - default:  The default value to return if the config variable is not set
 *
 * Example
 *   {modgetvar module='Example' name='foobar' assign='foobarOfExample'}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The module variable.
 */
function smarty_function_modgetvar($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    $module = isset($params['module']) ? $params['module'] : null;
    $html = isset($params['html']) ? (bool) $params['html'] : false;
    $name = isset($params['name']) ? $params['name'] : null;
    if (!$module) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modgetvar', 'module')));
        return false;
    }
    if (!$name && !$assign) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modgetvar', 'name')));
        return false;
    }
    if (!$name) {
        $result = ModUtil::getVar($module);
    } else {
        $result = ModUtil::getVar($module, $name, $default);
    }
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        if ($html) {
            return DataUtil::formatForDisplayHTML($result);
        } else {
            return DataUtil::formatForDisplay($result);
        }
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:54,代码来源:function.modgetvar.php

示例4: display

 /**
  * Display block
  */
 public function display($blockinfo)
 {
     if (!SecurityUtil::checkPermission('Zgoodies:marqueeblock:', "{$blockinfo['bid']}::", ACCESS_OVERVIEW)) {
         return;
     }
     if (!ModUtil::available('Zgoodies')) {
         return;
     }
     $vars = BlockUtil::varsFromContent($blockinfo['content']);
     $lang = ZLanguage::getLanguageCode();
     // block title
     if (isset($vars['block_title'][$lang]) && !empty($vars['block_title'][$lang])) {
         $blockinfo['title'] = $vars['block_title'][$lang];
     }
     // marquee content
     if (isset($vars['marquee_content'][$lang]) && !empty($vars['marquee_content'][$lang])) {
         $vars['marquee_content_lang'] = $vars['marquee_content'][$lang];
     }
     if (!isset($vars['marquee_content'])) {
         $vars['marquee_content_lang'] = '';
     }
     $this->view->assign('vars', $vars);
     $this->view->assign('bid', $blockinfo['bid']);
     $blockinfo['content'] = $this->view->fetch('blocks/' . $vars['block_template']);
     if (isset($vars['block_wrap']) && !$vars['block_wrap']) {
         if (empty($blockinfo['title'])) {
             return $blockinfo['content'];
         } else {
             return '<h4>' . DataUtil::formatForDisplayHTML($blockinfo['title']) . '</h4>' . "\n" . $blockinfo['content'];
         }
     }
     return BlockUtil::themeBlock($blockinfo);
 }
开发者ID:nmpetkov,项目名称:Zgoodies,代码行数:36,代码来源:Marquee.php

示例5: smarty_function_user

/**
 * Zikula_View function to display the user name
 *
 * Example
 * {user}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @see    function.userwelcome.php::smarty_function_user()
 *
 * @return string The username.
 */
function smarty_function_user($params, Zikula_View $view)
{
    if (UserUtil::isLoggedIn()) {
        $username = UserUtil::getVar('uname');
    } else {
        $username = __('anonymous guest');
    }
    return DataUtil::formatForDisplayHTML($username);
}
开发者ID:Silwereth,项目名称:core,代码行数:22,代码来源:function.user.php

示例6: smarty_modifier_contact

function smarty_modifier_contact($string)
{
    if (ereg("@", $string)) {
        $string = '<a href="mailto:' . $string . '">' . $string . '</a>';
    } else {
        $string = preg_replace_callback("#(\\w+)://([\\w\\+\\-\\@\\=\\?\\.\\%\\/\\:\\&\\;~\\|\\#]+)(\\.)?#", '_smarty_modifier_contact_callback', $string);
    }
    return DataUtil::formatForDisplayHTML($string);
}
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:9,代码来源:modifier.contact.php

示例7: reloadFlaggedBlock

    public function reloadFlaggedBlock() {
        // Security check
        if (!SecurityUtil::checkPermission('IWmain:flaggedBlock:', "::", ACCESS_READ) || !UserUtil::isLoggedIn()) {
            AjaxUtil::error(DataUtil::formatForDisplayHTML($this->__('Sorry! No authorization to access this module.')));
        }

        //get the headlines saved in the user vars. It is renovate every 10 minutes

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists',
                                    array('name' => 'flagged',
                                          'module' => 'IWmain_block_flagged',
                                          'uid' => UserUtil::getVar('uid'),
                                          'sv' => $sv));
        $chars = 15;
        if (!$exists) {
            ModUtil::func('IWmain', 'user', 'flagged',
                           array('where' => '',
                                 'chars' => $chars));
        }
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $have_flags = ModUtil::func('IWmain', 'user', 'userGetVar',
                                     array('uid' => UserUtil::getVar('uid'),
                                           'name' => 'have_flags',
                                           'module' => 'IWmain_block_flagged',
                                           'sv' => $sv));
        if ($have_flags != '0') {
            ModUtil::func('IWmain', 'user', 'flagged',
                           array('where' => $have_flags,
                                 'chars' => $chars));
            //Posa la variable d'usuari have_news en blanc per no haver-la de tornar a llegir a la propera reiteraci�
            $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
            ModUtil::func('IWmain', 'user', 'userSetVar',
                           array('uid' => UserUtil::getVar('uid'),
                                 'name' => 'have_flags',
                                 'module' => 'IWmain_block_flagged',
                                 'sv' => $sv,
                                 'value' => '0'));
        }

        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $flags = ModUtil::func('IWmain', 'user', 'userGetVar',
                                array('uid' => UserUtil::getVar('uid'),
                                      'name' => 'flagged',
                                      'module' => 'IWmain_block_flagged',
                                      'sv' => $sv,
                                      'nult' => true));

        $view = Zikula_View::getInstance('IWmain', false);

        $view->assign('flags', $flags);
        $content = $view->fetch('IWmain_block_iwflagged.tpl');

        return new Zikula_Response_Ajax(array('content' => $content,
                ));
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:56,代码来源:Ajax.php

示例8: displayEditing

 public function displayEditing()
 {
     // just show the header itself during page editing
     $this->view->assign('text', DataUtil::formatForDisplayHTML($this->text));
     $this->view->assign('headerSize', DataUtil::formatForDisplayHTML($this->headerSize));
     $this->view->assign('anchorName', DataUtil::formatForDisplayHTML($this->anchorName));
     $this->view->assign('displayPageTitle', $this->displayPageTitle);
     $this->view->assign('contentId', $this->contentId);
     return $this->view->fetch($this->getTemplate());
 }
开发者ID:robbrandt,项目名称:Content,代码行数:10,代码来源:Heading.php

示例9: displayEditing

 function displayEditing()
 {
     $text = DataUtil::formatForDisplayHTML($this->text);
     $source = DataUtil::formatForDisplayHTML($this->source);
     $desc = DataUtil::formatForDisplayHTML($this->desc);
     // this event should be moved to the template
     $event = new Zikula_Event('content.hook.contentitem.ui.filter', $this->view, array('caller' => $this->getModule()), $text);
     $text = $this->view->getEventManager()->notify($event)->getData();
     $text = '<div class="content-quote"><blockquote>' . $text . '</blockquote><p>-- ' . $desc . '</p></div>';
     return $text;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:11,代码来源:Quote.php

示例10: selectPostProcess

 public function selectPostProcess($data = null)
 {
     if (!$data) {
         $data =& $this->_objData;
     }
     if (!$data) {
         return $data;
     }
     $data['display_name'] = DataUtil::formatForDisplayHTML(unserialize($data['display_name']));
     $data['display_desc'] = DataUtil::formatForDisplayHTML(unserialize($data['display_desc']));
     $this->_objData = $data;
     return $data;
 }
开发者ID:Silwereth,项目名称:core,代码行数:13,代码来源:Category.php

示例11: smarty_modifier_customtype

function smarty_modifier_customtype($string)
{
    $ret_string = $string;
    $ar_type = array('varchar(60) default NULL', 'varchar(120) default NULL', 'varchar(240) default NULL', 'text', 'int default NULL', 'decimal(10,2) default NULL', 'date default NULL', 'dropdown', 'tinyint default NULL', 'smallint default NULL');
    $ar_dspname = array('Text, 60 chars, 1 line', 'Text, 120 chars, 2 lines', 'Text, 240 chars, 4 lines', 'Text, unlimited, 6 lines', 'Integer numbers', 'Decimal numbers', 'Date', 'Dropdown List', 'Blank line', 'Horizontal rule');
    for ($i = 0; $i < count($ar_type); $i++) {
        if ($string == $ar_type[$i]) {
            $ret_string = $ar_dspname[$i];
            break;
        }
    }
    return DataUtil::formatForDisplayHTML($ret_string);
}
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:13,代码来源:modifier.customtype.php

示例12: display

    function display()
    {
        if ($this->inputType == 'raw') {
            $text = DataUtil::formatForDisplay($this->text);
        } else {
            $text = DataUtil::formatForDisplayHTML($this->text);
        }

        $this->view->assign('inputType', $this->inputType);
        $this->view->assign('text', $text);

        return $this->view->fetch($this->getTemplate());
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:13,代码来源:Html.php

示例13: selectPostProcess

 public function selectPostProcess($objArray = null)
 {
     if (!$objArray) {
         $objArray =& $this->_objData;
     }
     if (!$objArray) {
         return $objArray;
     }
     foreach ($objArray as $k => $obj) {
         $objArray[$k]['display_name'] = DataUtil::formatForDisplayHTML(unserialize($obj['display_name']));
         $objArray[$k]['display_desc'] = DataUtil::formatForDisplayHTML(unserialize($obj['display_desc']));
     }
     return $objArray;
 }
开发者ID:rmaiwald,项目名称:core,代码行数:14,代码来源:CategoryArray.php

示例14: display

 function display()
 {
     $flickr = new phpFlickr(ModUtil::getVar('Content', 'flickrApiKey'));
     $flickr->enableCache("fs", System::getVar('temp'));
     // Find the NSID of the username
     $person = $flickr->people_findByUsername($this->userName);
     // Get the photos
     //$photos = $flickr->people_getPublicPhotos($person['id'], NULL, $this->photoCount);
     $photos = $flickr->photos_search(array('user_id' => $person['id'], 'tags' => $this->tags, 'per_page' => $this->photoCount));
     $photoData = array();
     foreach ((array) $photos['photo'] as $photo) {
         $photoData[] = array('title' => DataUtil::formatForDisplayHTML($this->decode($photo['title'])), 'src' => $flickr->buildPhotoURL($photo, "Square"), 'url' => "http://www.flickr.com/photos/{$photo['owner']}/{$photo['id']}");
     }
     $this->view->assign('photos', $photoData);
     return $this->view->fetch($this->getTemplate());
 }
开发者ID:robbrandt,项目名称:Content,代码行数:16,代码来源:Flickr.php

示例15: smarty_function_formutil_getpassedvalue

/**
 * FormUtil::getPassedValue().
 *
 * Available parameters:
 *   assign    The smarty variable to assign the retrieved value to.
 *   html      Wether or not to DataUtil::formatForDisplayHTML'ize the ML value.
 *   key       The key to retrieve from the input vector.
 *   name      Alias for key.
 *   default   The default value to return if the key is not set.
 *   source    The input source to retrieve the key from .
 *   noprocess If set, no processing is applied to the constant value.
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string
 *
 */
function smarty_function_formutil_getpassedvalue($params, Zikula_View $view)
{
    if ((!isset($params['key']) || !$params['key']) && (!isset($params['name']) || !$params['name'])) {
        // use name as an alias for key for programmer convenience
        $view->trigger_error('formutil_getpassedvalue: attribute key (or name) required');
        return false;
    }
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $key = isset($params['key']) ? $params['key'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    $html = isset($params['html']) ? $params['html'] : null;
    $source = isset($params['source']) ? $params['source'] : null;
    $noprocess = isset($params['noprocess']) ? $params['noprocess'] : null;
    if (!$key) {
        $key = isset($params['name']) ? $params['name'] : null;
    }
    $source = isset($source) ? $source : null;
    switch ($source) {
        case 'GET':
            $val = $view->getRequest()->query->get($key, $default);
            break;
        case 'POST':
            $val = $view->getRequest()->request->get($key, $default);
            break;
        case 'SERVER':
            $val = $view->getRequest()->server->get($key, $default);
            break;
        case 'FILES':
            $val = $view->getRequest()->files->get($key, $default);
            break;
        default:
            $val = $view->getRequest()->query->get($key, $view->getRequest()->request->get($key, $default));
            break;
    }
    if ($noprocess) {
        $val = $val;
    } elseif ($html) {
        $val = DataUtil::formatForDisplayHTML($val);
    } else {
        $val = DataUtil::formatForDisplay($val);
    }
    if ($assign) {
        $view->assign($assign, $val);
    } else {
        return $val;
    }
}
开发者ID:planetenkiller,项目名称:core,代码行数:65,代码来源:function.formutil_getpassedvalue.php


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