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


PHP obfuscate_text函数代码示例

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


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

示例1: obfuscate_mailto

/**
 * This function uses the {@link obfuscate_email()} and {@link obfuscate_text()}
 * to generate a fully obfuscated email link, ready to use.
 *
 * @param string $email The email address to display
 * @param string $label The text to displayed as hyperlink to $email
 * @param boolean $dimmed If true then use css class 'dimmed' for hyperlink
 * @return string The obfuscated mailto link
 */
function obfuscate_mailto($email, $label = '', $dimmed = false)
{
    if (empty($label)) {
        $label = $email;
    }
    if ($dimmed) {
        $title = get_string('emaildisable');
        $dimmed = ' class="dimmed"';
    } else {
        $title = '';
        $dimmed = '';
    }
    return sprintf("<a href=\"%s:%s\" {$dimmed} title=\"{$title}\">%s</a>", obfuscate_text('mailto'), obfuscate_email($email), obfuscate_text($label));
}
开发者ID:hatone,项目名称:moodle,代码行数:23,代码来源:weblib.php

示例2: obfuscate_mailto

/**
 * This function uses the {@link obfuscate_email()} and {@link obfuscate_text()}
 * to generate a fully obfuscated email link, ready to use.
 *
 * @param string $email The email address to display
 * @param string $label The text to displayed as hyperlink to $email
 * @param boolean $dimmed If true then use css class 'dimmed' for hyperlink
 * @param string $subject The subject of the email in the mailto link
 * @param string $body The content of the email in the mailto link
 * @return string The obfuscated mailto link
 */
function obfuscate_mailto($email, $label = '', $dimmed = false, $subject = '', $body = '')
{
    if (empty($label)) {
        $label = $email;
    }
    $label = obfuscate_text($label);
    $email = obfuscate_email($email);
    $mailto = obfuscate_text('mailto');
    $url = new moodle_url("mailto:{$email}");
    $attrs = array();
    if (!empty($subject)) {
        $url->param('subject', format_string($subject));
    }
    if (!empty($body)) {
        $url->param('body', format_string($body));
    }
    // Use the obfuscated mailto.
    $url = preg_replace('/^mailto/', $mailto, $url->out());
    if ($dimmed) {
        $attrs['title'] = get_string('emaildisable');
        $attrs['class'] = 'dimmed';
    }
    return html_writer::link($url, $label, $attrs);
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:35,代码来源:weblib.php

示例3: test_obfuscate_text

 public function test_obfuscate_text()
 {
     $text = 'Žluťoučký koníček 32131';
     $obfuscated = obfuscate_text($text);
     $this->assertNotSame($text, $obfuscated);
     $back = core_text::entities_to_utf8($obfuscated, true);
     $this->assertSame($text, $back);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:8,代码来源:weblib_test.php

示例4: alter_email

function alter_email($matches)
{
    return $matches[1] . obfuscate_text($matches[2]) . $matches[3];
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:4,代码来源:filter.php


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