當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。