當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mosHTML::encoding_converter方法代碼示例

本文整理匯總了PHP中mosHTML::encoding_converter方法的典型用法代碼示例。如果您正苦於以下問題:PHP mosHTML::encoding_converter方法的具體用法?PHP mosHTML::encoding_converter怎麽用?PHP mosHTML::encoding_converter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mosHTML的用法示例。


在下文中一共展示了mosHTML::encoding_converter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: emailCloaking

 /**
  * simple Javascript Cloaking
  * email cloacking
  * by default replaces an email with a mailto link with email cloacked
  */
 function emailCloaking($mail, $mailto = 1, $text = '', $email = 1)
 {
     // convert text
     $mail = mosHTML::encoding_converter($mail);
     // split email by @ symbol
     $mail = explode('@', $mail);
     $mail_parts = explode('.', $mail[1]);
     // random number
     $rand = rand(1, 100000);
     $replacement = "\n<script language='JavaScript' type='text/javascript'> \n";
     $replacement .= "<!-- \n";
     $replacement .= "var prefix = '&#109;a' + 'i&#108;' + '&#116;o'; \n";
     $replacement .= "var path = 'hr' + 'ef' + '='; \n";
     $replacement .= "var addy" . $rand . " = '" . @$mail[0] . "' + '&#64;' + '" . implode("' + '&#46;' + '", $mail_parts) . "'; \n";
     if ($mailto) {
         // special handling when mail text is different from mail addy
         if ($text) {
             if ($email) {
                 // convert text
                 $text = mosHTML::encoding_converter($text);
                 // split email by @ symbol
                 $text = explode('@', $text);
                 $text_parts = explode('.', $text[1]);
                 $replacement .= "var addy_text" . $rand . " = '" . @$text[0] . "' + '&#64;' + '" . implode("' + '&#46;' + '", @$text_parts) . "'; \n";
             } else {
                 $text = mosHTML::encoding_converter($text);
                 $replacement .= "var addy_text" . $rand . " = '" . $text . "';\n";
             }
             $replacement .= "document.write( '<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>' ); \n";
             $replacement .= "document.write( addy_text" . $rand . " ); \n";
             $replacement .= "document.write( '<\\/a>' ); \n";
         } else {
             $replacement .= "document.write( '<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>' ); \n";
             $replacement .= "document.write( addy" . $rand . " ); \n";
             $replacement .= "document.write( '<\\/a>' ); \n";
         }
     } else {
         $replacement .= "document.write( addy" . $rand . " ); \n";
     }
     $replacement .= "//--> \n";
     $replacement .= "</script> \n";
     $replacement .= "<noscript> \n";
     $replacement .= T_('This email address is being protected from spam bots, you need Javascript enabled to view it');
     $replacement .= "\n</noscript> \n";
     return $replacement;
 }
開發者ID:jwest00724,項目名稱:mambo,代碼行數:51,代碼來源:mamboHTML.php

示例2: emailCloaking

 /**
  * simple Javascript Cloaking
  * email cloacking
  * by default replaces an email with a mailto link with email cloacked
  */
 function emailCloaking($mail, $mailto = 1, $text = '', $email = 1)
 {
     // convert text
     $mail = mosHTML::encoding_converter($mail);
     // split email by @ symbol
     $mail = explode('@', $mail);
     $mail_parts = explode('.', $mail[1]);
     // random number
     $rand = rand(1, 100000);
     $replacement = "\n <script language='JavaScript' type='text/javascript'>";
     $replacement .= "\n <!--";
     $replacement .= "\n var prefix = '&#109;a' + 'i&#108;' + '&#116;o';";
     $replacement .= "\n var path = 'hr' + 'ef' + '=';";
     $replacement .= "\n var addy" . $rand . " = '" . @$mail[0] . "' + '&#64;';";
     $replacement .= "\n addy" . $rand . " = addy" . $rand . " + '" . implode("' + '&#46;' + '", $mail_parts) . "';";
     if ($mailto) {
         // special handling when mail text is different from mail addy
         if ($text) {
             if ($email) {
                 // convert text
                 $text = mosHTML::encoding_converter($text);
                 // split email by @ symbol
                 $text = explode('@', $text);
                 $text_parts = explode('.', $text[1]);
                 $replacement .= "\n var addy_text" . $rand . " = '" . @$text[0] . "' + '&#64;' + '" . implode("' + '&#46;' + '", @$text_parts) . "';";
             } else {
                 $replacement .= "\n var addy_text" . $rand . " = '" . $text . "';";
             }
             $replacement .= "\n document.write( '<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>' );";
             $replacement .= "\n document.write( addy_text" . $rand . " );";
             $replacement .= "\n document.write( '<\\/a>' );";
         } else {
             $replacement .= "\n document.write( '<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>' );";
             $replacement .= "\n document.write( addy" . $rand . " );";
             $replacement .= "\n document.write( '<\\/a>' );";
         }
     } else {
         $replacement .= "\n document.write( addy" . $rand . " );";
     }
     $replacement .= "\n //-->";
     $replacement .= '\\n </script>';
     // XHTML compliance `No Javascript` text handling
     $replacement .= "<script language='JavaScript' type='text/javascript'>";
     $replacement .= "\n <!--";
     $replacement .= "\n document.write( '<span style=\\'display: none;\\'>' );";
     $replacement .= "\n //-->";
     $replacement .= "\n </script>";
     $replacement .= _CLOAKING;
     $replacement .= "\n <script language='JavaScript' type='text/javascript'>";
     $replacement .= "\n <!--";
     $replacement .= "\n document.write( '</' );";
     $replacement .= "\n document.write( 'span>' );";
     $replacement .= "\n //-->";
     $replacement .= "\n </script>";
     return $replacement;
 }
開發者ID:patricmutwiri,項目名稱:joomlaclube,代碼行數:61,代碼來源:joomla.php


注:本文中的mosHTML::encoding_converter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。