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


PHP hsc函数代码示例

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


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

示例1: Dwoo_Plugin_display_default_name

/**
 * Dwoo {display_default_name} function plugin
 *
 * Type:     function<br>
 * Date:     2012-06-11<br>
 * Purpose:  Escape output of display_default_name for use in templates
 * @version  1.0
 */
function Dwoo_Plugin_display_default_name(Dwoo $dwoo, $user)
{
    if (!$user) {
        return '';
    }
    return hsc(display_default_name($user));
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:15,代码来源:display_default_name.php

示例2: tpl_breadcrumbs_bootstrap

/**
 * Print the breadcrumbs trace with Bootstrap class
 *
 * @author Nicolas GERARD
 *
 * @param string $sep Separator between entries
 * @return bool
 */
function tpl_breadcrumbs_bootstrap($sep = '�')
{
    global $conf;
    global $lang;
    //check if enabled
    if (!$conf['breadcrumbs']) {
        return false;
    }
    $crumbs = array_reverse(breadcrumbs());
    //setup crumb trace
    $last = count($crumbs);
    $i = 0;
    echo '<ol class="breadcrumb">' . PHP_EOL;
    foreach ($crumbs as $id => $name) {
        $i++;
        if ($i == $last) {
            print '<li class="active">';
        } else {
            print '<li>';
        }
        if ($i == 1) {
            // Try to get the template custom breadcrumb
            $breadCrumb = tpl_getLang('breadcrumb');
            if ($breadCrumb == '') {
                // If not present for the language, get the default one
                $breadCrumb = $lang['breadcrumb'];
            }
            echo $breadCrumb . ': ';
        }
        tpl_link(wl($id), hsc($name), 'title="' . $id . '"');
        print '</li>' . PHP_EOL;
    }
    echo '</ol>' . PHP_EOL;
    return true;
}
开发者ID:alanthonyc,项目名称:dokuwiki-template-bootie,代码行数:43,代码来源:tpl_template_NicoBoot.php

示例3: pieform_element_rolepermissions

function pieform_element_rolepermissions(Pieform $form, $element)
{
    /*{{{*/
    $value = $form->get_value($element);
    $roles = group_get_role_info($element['group']);
    $permissions = array_keys(get_object_vars($value['member']));
    $result = '<table class="editpermissions"><tbody>';
    $result .= '<tr><th>' . get_string('Role', 'group') . '</th>';
    foreach ($permissions as $p) {
        $result .= '<th>' . get_string('filepermission.' . $p, 'artefact.file') . '</th>';
    }
    $result .= '</tr>';
    $prefix = $form->get_name() . '_' . $element['name'] . '_p';
    foreach ($roles as $r) {
        $result .= '<tr>';
        $result .= '<td>' . hsc($r->display) . '</td>';
        foreach ($permissions as $p) {
            $inputname = $prefix . '_' . $r->name . '_' . $p;
            $result .= '<td><input type="checkbox" class="permission" name="' . hsc($inputname) . '"';
            if ($r->name == 'admin') {
                $result .= ' checked disabled';
            } else {
                if ($value[$r->name]->{$p}) {
                    $result .= ' checked';
                }
            }
            $result .= '/></td>';
        }
        $result .= '</tr>';
    }
    $result .= '</tbody></table>';
    return $result;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:33,代码来源:rolepermissions.php

示例4: run

 /**
  * Build a nice email from the submitted data and send it
  */
 function run($data, $thanks, $argv)
 {
     global $ID;
     // get recipient address(es)
     $to = join(',', $argv);
     $sub = sprintf($this->getLang('mailsubject'), $ID);
     $txt = sprintf($this->getLang('mailintro') . "\n\n\n", dformat());
     foreach ($data as $opt) {
         $value = $opt->getParam('value');
         $label = $opt->getParam('label');
         switch ($opt->getFieldType()) {
             case 'fieldset':
                 $txt .= "\n====== " . hsc($label) . " ======\n\n";
                 break;
             default:
                 if ($value === null || $label === null) {
                     break;
                 }
                 $txt .= $label . "\n";
                 $txt .= "\t\t{$value}\n";
         }
     }
     global $conf;
     if (!mail_send($to, $sub, $txt, $conf['mailfrom'])) {
         throw new Exception($this->getLang('e_mail'));
     }
     return $thanks;
 }
开发者ID:nefercheprure,项目名称:dokuwiki-plugin-bureaucracy,代码行数:31,代码来源:mail.php

示例5: render

 function render($mode, Doku_Renderer $renderer, $data)
 {
     if (empty($data)) {
         return false;
     }
     if ($mode == 'xhtml') {
         /** @var Doku_Renderer_xhtml $renderer */
         list($state, $match, $attributes) = $data;
         switch ($state) {
             case DOKU_LEXER_ENTER:
                 $placement = $attributes['placement'];
                 $title = $attributes['title'];
                 $html = $attributes['html'];
                 if ($html) {
                     $title = hsc(p_render('xhtml', p_get_instructions($title), $info));
                 }
                 $markup = sprintf('<span class="bs-wrap bs-wrap-tooltip" data-toggle="tooltip" data-html="%s" data-placement="%s" title="%s" style="border-bottom:1px dotted">', $html, $placement, $title);
                 $renderer->doc .= $markup;
                 return true;
             case DOKU_LEXER_EXIT:
                 $renderer->doc .= '</span>';
                 return true;
         }
         return true;
     }
     return false;
 }
开发者ID:Juergen-aus-Koeln,项目名称:dokuwiki-plugin-bootswrapper,代码行数:27,代码来源:tooltip.php

示例6: handle

 function handle($match, $state, $pos, &$handler)
 {
     $width = 320;
     $height = 240;
     $params['scaling'] = '"fit"';
     $params['autoPlay'] = 'false';
     $params['urlEncoding'] = 'true';
     list($url, $attr) = explode(" ", hsc(trim(substr($match, 13, -2))), 2);
     foreach (explode(" ", $attr) as $param) {
         if (preg_match('/(\\d+),(\\d+)/', $param, $res)) {
             $width = intval($res[1]);
             $height = intval($res[2]);
         } else {
             if (preg_match('/([^:]+):(.*)$/', $param, $res)) {
                 $params[strtolower(substr($res[1], 0, 1)) . substr($res[1], 1)] = '"' . $res[2] . '"';
             } else {
                 if (preg_match('/no(\\w+)/', $param, $res)) {
                     $params[strtolower(substr($res[1], 0, 1)) . substr($res[1], 1)] = 'false';
                 } else {
                     if (preg_match('/(\\w+)/', $param, $res)) {
                         $params[strtolower(substr($res[1], 0, 1)) . substr($res[1], 1)] = 'true';
                     }
                 }
             }
         }
     }
     if (strpos($url, '://') === false) {
         $url = ml($url);
     }
     return array('url' => $url, 'width' => $width, 'height' => $height, 'fid' => uniqid(), 'attr' => $params);
 }
开发者ID:RedRat,项目名称:flowplayer,代码行数:31,代码来源:syntax.php

示例7: create_preview

 public function create_preview()
 {
     $width = $this->get_preview_width();
     $height = $this->get_preview_height();
     $id = uniqid('lid');
     $layout = "<svg xmlns=http://www.w3.org/2000/svg role='img' width='{$width}' height='{$height}' aria-labelledby='title{$id} desc{$id}'>";
     if (!empty($this->text)) {
         $layout .= "<title id='title{$id}' >" . get_string('layoutpreviewimage', 'view') . "</title>";
         $layout .= "<desc id='desc{$id}'>" . hsc($this->text) . "</desc>";
     }
     $x = 0;
     $y = 0;
     $col_height = $this->get_preview_column_height();
     $class = true;
     foreach ($this->layout as $key => $row) {
         $style = 'layout' . (int) $class;
         $columns = explode(',', $row);
         foreach ($columns as $column) {
             $col_width = $this->get_percentage_column_width(count($columns), $column);
             $layout .= "<rect x='" . number_format($x, 2, '.', '') . "' y='" . number_format($y, 2, '.', '') . "' width='" . number_format($col_width, 2, '.', '') . "' height='" . number_format($col_height, 2, '.', '') . "' class='{$style}'/>";
             $x += $col_width + self::$spacer;
             // increment x val for next col
         }
         $x = 0;
         $y += $col_height + self::$spacer;
         // increment y val for next row
         $class = !$class;
     }
     $layout .= '</svg>';
     return $layout;
 }
开发者ID:vohung96,项目名称:mahara,代码行数:31,代码来源:layoutpreviewimage.php

示例8: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     if (!isset($configdata['appsid'])) {
         return;
     }
     $apps = self::make_apps_url($configdata['appsid']);
     $url = hsc($apps['url']);
     $type = hsc($apps['type']);
     $height = !empty($configdata['height']) ? intval($configdata['height']) : self::$default_height;
     if (isset($configdata['appsid']) && !empty($type)) {
         $smarty = smarty_core();
         $smarty->assign('url', $apps['url']);
         switch ($type) {
             case 'iframe':
                 // Google Docs (documents, presentations, spreadsheets, forms), Google Calendar, Google Maps
                 $smarty->assign('height', $height);
                 return $smarty->fetch('blocktype:googleapps:iframe.tpl');
             case 'spanicon':
                 // Google Docs collections (folder icon)
                 $smarty->assign('img', get_config('wwwroot') . 'blocktype/googleapps/images/folder_documents.png');
                 return $smarty->fetch('blocktype:googleapps:spanicon.tpl');
             case 'image':
                 // Google Docs drawing
                 $smarty->assign('height', $height);
                 return $smarty->fetch('blocktype:googleapps:image.tpl');
         }
     }
     return get_string('badurlerror', 'blocktype.googleapps', $url);
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:30,代码来源:lib.php

示例9: title

 /**
  * Build SEO title
  *
  * @param string $pageTitle Title of the current item/page/posts...
  */
 function title($pageTitle = null)
 {
     if (!is_object($this->controller)) {
         return;
     }
     if (!$pageTitle) {
         $pageTitle = $this->controller->pageTitle;
     }
     if (!$pageTitle) {
         $pageTitle = ucwords($this->controller->params['controller']);
     }
     $description = Configure::read('AppSettings.description');
     $nameAndDescription = hsc(Configure::read('AppSettings.site_name'));
     if ($description) {
         $description = hsc($description);
         $nameAndDescription = "{$nameAndDescription} - {$description}";
     }
     if ($this->controller->isHome) {
         $this->controller->pageTitle = $nameAndDescription;
     } else {
         $this->controller->pageTitle = "{$pageTitle} &bull; {$nameAndDescription}";
     }
     $this->controller->set('page_title_for_layout', $pageTitle);
     $this->controller->set('site_title_for_layout', $nameAndDescription);
 }
开发者ID:alfo1,项目名称:wildflower,代码行数:30,代码来源:seo.php

示例10: slackinvite_signinform

 /**
  * form for slack invite
  *
  *
  */
 function slackinvite_signinform()
 {
     global $ID;
     $html = '';
     $params = array();
     $params['id'] = 'slackinvite_plugin_id';
     $params['action'] = wl($ID);
     $params['method'] = 'post';
     $params['enctype'] = 'multipart/form-data';
     $params['class'] = 'slackinvite_plugin';
     // Modification of the default dw HTML upload form
     $form = new Doku_Form($params);
     $form->startFieldset($this->getLang('signup'));
     $form->addHidden('source', hsc("slackinvite"));
     //add source of call, used in action to ignore anything not from this form
     $form->addElement(form_makeTextField('first_name', '', $this->getLang('first_name'), 'first__name'));
     $form->addElement(form_makeTextField('last_name', '', $this->getLang('last_name'), 'last__name'));
     $form->addElement(form_makeTextField('email', '', $this->getLang('email'), 'email'));
     $form->addElement(form_makeButton('submit', 'slacksignup', $this->getLang('btn_signup')));
     $form->endFieldset();
     $html .= '<div class="dokuwiki"><p>' . NL;
     //$html .= '<h3>TEAM43 Slack Sign Up</h3>';
     $html .= $form->getForm();
     $html .= '</p></div>' . NL;
     return $html;
 }
开发者ID:Jocai,项目名称:Door43,代码行数:31,代码来源:syntax.php

示例11: amdy_tpl_breadcrumbs

function amdy_tpl_breadcrumbs()
{
    global $lang;
    global $conf;
    //check if enabled
    if (!$conf['breadcrumbs']) {
        return false;
    }
    $crumbs = breadcrumbs();
    //setup crumb trace
    //render crumbs, highlight the last one
    print '<ul class="breadcrumb">';
    $last = count($crumbs);
    $i = 0;
    foreach ($crumbs as $id => $name) {
        $i++;
        echo '<li' . ($i == $last ? ' class="active"' : '') . '>';
        //echo '<a href="test.php">test</a>';
        echo '<a href="' . wl($id) . '" title="' . $id . '"' . '>' . hsc($name) . '</a>';
        if ($i != $last) {
            echo '<span class="divider">/</span>';
        }
        echo '</li>';
    }
    print '</ul>';
    return true;
}
开发者ID:nduhamel,项目名称:Dokuwiki-Template-Twitter,代码行数:27,代码来源:template.php

示例12: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     // this will make sure to unserialize it for us
     $configdata['viewid'] = $instance->get('view');
     // This can be either an image or profileicon. They both implement
     // render_self
     $result = '';
     if (isset($configdata['artefactid'])) {
         $image = $instance->get_artefact_instance($configdata['artefactid']);
         if ($image instanceof ArtefactTypeProfileIcon) {
             $src = get_config('wwwroot') . 'thumb.php?type=profileiconbyid&id=' . $configdata['artefactid'];
             $description = $image->get('title');
         } else {
             $src = get_config('wwwroot') . 'artefact/file/download.php?file=' . $configdata['artefactid'];
             $src .= '&view=' . $instance->get('view');
             $description = $image->get('description');
         }
         if (!empty($configdata['width'])) {
             $src .= '&maxwidth=' . $configdata['width'];
         }
         $result = '<div class="center"><div>';
         $result .= '<a href="' . get_config('wwwroot') . 'view/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view') . '"><img src="' . hsc($src) . '" alt="' . hsc($description) . '"></a>';
         $result .= '</div>';
         $description = is_a($image, 'ArtefacttypeImage') ? $image->get('description') : $image->get('title');
         if (!empty($configdata['showdescription']) && $description) {
             $result .= '<p>' . hsc($description) . '</p>';
         }
         $result .= '</div>';
     }
     return $result;
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:32,代码来源:lib.php

示例13: handle_start

 function handle_start(&$event, $param)
 {
     global $ID;
     global $ACT;
     global $INFO;
     if ($ACT != 'show') {
         return;
     }
     if (!$INFO['exists']) {
         return;
     }
     # don't try to read an article that doesn't exist
     $all = rtrim(rawWiki($ID));
     $inner = substr($all, 2, -2);
     if ($all == '[[' . $inner . ']]' and strpos($inner, '[[') === false and strpos($inner, ']]') === false) {
         if (!strpos($inner, '://') === false) {
             $url = $inner;
             # link is URL already
         } else {
             msg(sprintf('From: <a href="' . wl($ID, 'do=edit') . '">' . hsc($ID) . '</a>'));
             $url = html_wikilink($inner, $name = null, $search = '');
             $url = substr($url, strpos($url, '"') + 1);
             $url = substr($url, 0, strpos($url, '"'));
         }
         idx_addPage($ID);
         # ensure fulltext search indexing of referrer article - to put it on the backlink page of target article
         send_redirect($url);
     }
 }
开发者ID:demiankatz,项目名称:dokuwiki-mredirect,代码行数:29,代码来源:action.php

示例14: handle_start

    /**
     * Do the magic
     */
    function handle_start(&$event, $param)
    {
        global $conf;
        $bans = @file($conf['cachedir'] . '/ipbanplugin.txt');
        $client = clientIP(true);
        if (is_array($bans)) {
            foreach ($bans as $ban) {
                $fields = explode("\t", $ban);
                if ($fields[0] == $client) {
                    $text = $this->locale_xhtml('banned');
                    $text .= sprintf('<p>' . $this->getLang('banned') . '</p>', hsc($client), strftime($conf['dformat'], $fields[1]), hsc($fields[3]));
                    $title = $this->getLang('denied');
                    header("HTTP/1.0 403 Forbidden");
                    echo <<<EOT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>{$title}</title></head>
<body style="font-family: Arial, sans-serif">
  <div style="width:60%; margin: auto; background-color: #fcc;
              border: 1px solid #faa; padding: 0.5em 1em;">
  {$text}
  </div>
</body>
</html>
EOT;
                    exit;
                }
            }
        }
    }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-ipban,代码行数:34,代码来源:action.php

示例15: getDesignList

function getDesignList($start, $count, $list, $i18nBy)
{
    global $legacyMode;
    // flush return value
    $return = "";
    // check for language URL
    global $langURL;
    // begin at the already-established start of the list and loop down
    for ($i = $start - 1; $i >= $start - $count; $i--) {
        $id = $list[$i][0];
        $designURL = $langURL . "/{$id}/";
        // prepend for translation pages
        $designName = hsc($list[$i][1]);
        $designerName = hsc($list[$i][2]);
        $designerURL = hsc($list[$i][3]);
        // kick in output buffering
        ob_start();
        // pull in the correct partial template for design listings
        if (isset($legacyMode)) {
            include $SERVER_ROOT . "tmpl-design-link-legacy.php";
        } else {
            include $SERVER_ROOT . "tmpl-design-link.php";
        }
        // dump and close buffering
        $buffer = ob_get_contents();
        ob_end_clean();
        // add the buffer to return string if we're still within range
        if ($i >= 0) {
            $return .= $buffer;
        }
    }
    // send back the generated design list
    return $return;
}
开发者ID:charygao,项目名称:csszengarden.com,代码行数:34,代码来源:functions.php


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