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


PHP Email::obfuscate方法代码示例

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


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

示例1: output

 public function output()
 {
     // TODO: Refactor into a content-type option
     if (\Director::is_ajax()) {
         return $this->friendlyErrorMessage;
     } else {
         // TODO: Refactor this into CMS
         if (class_exists('ErrorPage')) {
             $errorFilePath = \ErrorPage::get_filepath_for_errorcode($this->statusCode, class_exists('Translatable') ? \Translatable::get_current_locale() : null);
             if (file_exists($errorFilePath)) {
                 $content = file_get_contents($errorFilePath);
                 if (!headers_sent()) {
                     header('Content-Type: text/html');
                 }
                 // $BaseURL is left dynamic in error-###.html, so that multi-domain sites don't get broken
                 return str_replace('$BaseURL', \Director::absoluteBaseURL(), $content);
             }
         }
         $renderer = \Debug::create_debug_view();
         $output = $renderer->renderHeader();
         $output .= $renderer->renderInfo("Website Error", $this->friendlyErrorMessage, $this->friendlyErrorDetail);
         if (\Email::config()->admin_email) {
             $mailto = \Email::obfuscate(\Email::config()->admin_email);
             $output .= $renderer->renderParagraph('Contact an administrator: ' . $mailto . '');
         }
         $output .= $renderer->renderFooter();
         return $output;
     }
 }
开发者ID:vinstah,项目名称:silverstripe-framework,代码行数:29,代码来源:DebugViewFriendlyErrorFormatter.php

示例2: testObfuscate

 public function testObfuscate()
 {
     $emailAddress = 'test-1@example.com';
     $direction = Email::obfuscate($emailAddress, 'direction');
     $visible = Email::obfuscate($emailAddress, 'visible');
     $hex = Email::obfuscate($emailAddress, 'hex');
     $this->assertEquals('<span class="codedirection">moc.elpmaxe@1-tset</span>', $direction, 'obfuscate() correctly reverses the email direction');
     $this->assertEquals('test [dash] 1 [at] example [dot] com', $visible, 'obfuscate() correctly obfuscates email characters');
     $this->assertEquals('&#x74;&#x65;&#x73;&#x74;&#x2d;&#x31;&#x40;&#x65;&#x78;&#x61;&#x6d;&#x70;' . '&#x6c;&#x65;&#x2e;&#x63;&#x6f;&#x6d;', $hex, 'obfuscate() correctly returns hex representation of email');
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:10,代码来源:EmailTest.php

示例3: ObfuscatedEmail

 /**
  * Return the obfuscated email
  */
 public function ObfuscatedEmail()
 {
     return $this->Email ? Email::obfuscate($this->Email, 'hex') : null;
 }
开发者ID:helpfulrobot,项目名称:dnadesign-silverstripe-elemental,代码行数:7,代码来源:ElementContact.php

示例4: friendlyError

 /**
  * Render a user-facing error page, using the default HTML error template
  * rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link SS_HTTPResponse} class
  * the keep dependencies minimal. 
  * 
  * @uses ErrorPage
  *
  * @param int $statusCode HTTP Status Code (Default: 500)
  * @param string $friendlyErrorMessage User-focused error message. Should not contain code pointers
  *                                     or "tech-speak". Used in the HTTP Header and ajax responses.
  * @param string $friendlyErrorDetail Detailed user-focused message. Is just used if no {@link ErrorPage} is found
  *                                    for this specific status code.
  * @return string HTML error message for non-ajax requests, plaintext for ajax-request.
  */
 public static function friendlyError($statusCode = 500, $friendlyErrorMessage = null, $friendlyErrorDetail = null)
 {
     if (!$friendlyErrorMessage) {
         $friendlyErrorMessage = Config::inst()->get('Debug', 'friendly_error_header');
     }
     if (!$friendlyErrorDetail) {
         $friendlyErrorDetail = Config::inst()->get('Debug', 'friendly_error_detail');
     }
     if (!headers_sent()) {
         $currController = Controller::has_curr() ? Controller::curr() : null;
         // Ensure the error message complies with the HTTP 1.1 spec
         $msg = strip_tags(str_replace(array("\n", "\r"), '', $friendlyErrorMessage));
         if ($currController) {
             $response = $currController->getResponse();
             $response->setStatusCode($statusCode, $msg);
         } else {
             header($_SERVER['SERVER_PROTOCOL'] . " {$statusCode} {$msg}");
         }
     }
     if (Director::is_ajax()) {
         echo $friendlyErrorMessage;
     } else {
         if (class_exists('ErrorPage')) {
             $errorFilePath = ErrorPage::get_filepath_for_errorcode($statusCode, class_exists('Translatable') ? Translatable::get_current_locale() : null);
             if (file_exists($errorFilePath)) {
                 $content = file_get_contents(ASSETS_PATH . "/error-{$statusCode}.html");
                 // $BaseURL is left dynamic in error-###.html, so that multi-domain sites don't get broken
                 echo str_replace('$BaseURL', Director::absoluteBaseURL(), $content);
             }
         } else {
             $renderer = new DebugView();
             $renderer->writeHeader();
             $renderer->writeInfo("Website Error", $friendlyErrorMessage, $friendlyErrorDetail);
             if (Email::config()->admin_email) {
                 $mailto = Email::obfuscate(Email::config()->admin_email);
                 $renderer->writeParagraph('Contact an administrator: ' . $mailto . '');
             }
             $renderer->writeFooter();
         }
     }
     return false;
 }
开发者ID:jareddreyer,项目名称:catalogue,代码行数:56,代码来源:Debug.php

示例5: EncodedEmail

 /**
  * Email encoded in html character entities.
  * 
  * @return string
  */
 public function EncodedEmail()
 {
     // return CleanUtils::html_obfuscate($this->owner->Email);
     return Email::obfuscate($this->owner->Email, 'hex');
 }
开发者ID:helpfulrobot,项目名称:arillo-silverstripe-cleanutilities,代码行数:10,代码来源:SiteConfigAddressExtension.php

示例6: friendlyError

 /**
  * Render a user-facing error page, using the default HTML error template
  * rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link SS_HTTPResponse} class
  * the keep dependencies minimal. 
  * 
  * @uses ErrorPage
  *
  * @param int $statusCode HTTP Status Code (Default: 500)
  * @param string $friendlyErrorMessage User-focused error message. Should not contain code pointers or "tech-speak".
  *    Used in the HTTP Header and ajax responses.
  * @param string $friendlyErrorDetail Detailed user-focused message. Is just used if no {@link ErrorPage} is found
  *    for this specific status code.
  * @return string HTML error message for non-ajax requests, plaintext for ajax-request.
  */
 static function friendlyError($statusCode = 500, $friendlyErrorMessage = null, $friendlyErrorDetail = null)
 {
     if (!$friendlyErrorMessage) {
         $friendlyErrorMessage = self::$friendly_error_header;
     }
     if (!$friendlyErrorDetail) {
         $friendlyErrorDetail = self::$friendly_error_detail;
     }
     if (!headers_sent()) {
         header(sprintf('%s %d %s', $_SERVER['SERVER_PROTOCOL'], $statusCode, strip_tags(str_replace(array("\n", "\r"), '', $friendlyErrorMessage))));
     }
     if (Director::is_ajax()) {
         echo $friendlyErrorMessage;
     } else {
         $errorFilePath = ErrorPage::get_filepath_for_errorcode($statusCode, Translatable::get_current_locale());
         if (file_exists($errorFilePath)) {
             $content = file_get_contents(ASSETS_PATH . "/error-{$statusCode}.html");
             // $BaseURL is left dynamic in error-###.html, so that multi-domain sites don't get broken
             echo str_replace('$BaseURL', Director::absoluteBaseURL(), $content);
         } else {
             $renderer = new DebugView();
             $renderer->writeHeader();
             $renderer->writeInfo("Website Error", $friendlyErrorMessage, $friendlyErrorDetail);
             if (Email::getAdminEmail()) {
                 $mailto = Email::obfuscate(Email::getAdminEmail());
                 $renderer->writeParagraph('Contact an administrator: ' . $mailto . '');
             }
             $renderer->writeFooter();
         }
     }
 }
开发者ID:Raiser,项目名称:Praktikum,代码行数:45,代码来源:Debug.php

示例7: output

 /**
  * Return the appropriate error content for the given status code
  *
  * @param int $statusCode
  * @return string Content in an appropriate format for the current request
  */
 public function output($statusCode)
 {
     // TODO: Refactor into a content-type option
     if (\Director::is_ajax()) {
         return $this->getTitle();
     }
     $renderer = \Debug::create_debug_view();
     $output = $renderer->renderHeader();
     $output .= $renderer->renderInfo("Website Error", $this->getTitle(), $this->getBody());
     if (\Email::config()->admin_email) {
         $mailto = \Email::obfuscate(\Email::config()->admin_email);
         $output .= $renderer->renderParagraph('Contact an administrator: ' . $mailto . '');
     }
     $output .= $renderer->renderFooter();
     return $output;
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:22,代码来源:DebugViewFriendlyErrorFormatter.php

示例8: friendlyError

 /**
  * Render a user-facing error page, using the default HTML error template
  * rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link HTTPResponse} class
  * the keep dependencies minimal. 
  * 
  * @uses ErrorPage
  *
  * @param int $statusCode HTTP Status Code (Default: 500)
  * @param string $friendlyErrorMessage User-focused error message. Should not contain code pointers or "tech-speak".
  *    Used in the HTTP Header and ajax responses.
  * @param string $friendlyErrorDetail Detailed user-focused message. Is just used if no {@link ErrorPage} is found
  *    for this specific status code.
  * @return string HTML error message for non-ajax requests, plaintext for ajax-request.
  */
 static function friendlyError($statusCode = 500, $friendlyErrorMessage = null, $friendlyErrorDetail = null)
 {
     if (!$friendlyErrorMessage) {
         $friendlyErrorMessage = 'There has been an error';
     }
     if (!$friendlyErrorDetail) {
         $friendlyErrorDetail = 'The website server has not been able to respond to your request.';
     }
     if (!headers_sent()) {
         header($_SERVER['SERVER_PROTOCOL'] . " {$statusCode} {$friendlyErrorMessage}");
     }
     if (Director::is_ajax()) {
         echo $friendlyErrorMessage;
     } else {
         $errorFilePath = ErrorPage::get_filepath_for_errorcode($statusCode, Translatable::get_current_locale());
         if (file_exists($errorFilePath)) {
             echo file_get_contents($errorFilePath);
         } else {
             $renderer = new DebugView();
             $renderer->writeHeader();
             $renderer->writeInfo("Website Error", $friendlyErrorMessage, $friendlyErrorDetail);
             if (Email::getAdminEmail()) {
                 $mailto = Email::obfuscate(Email::getAdminEmail());
                 $renderer->writeParagraph('Contact an administrator: ' . $mailto . '');
             }
             $renderer->writeFooter();
         }
     }
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:43,代码来源:Debug.php

示例9: friendlyError

	/**
	 * Render a user-facing error page, using the default HTML error template
	 * rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link HTTPResponse} class
	 * the keep dependencies minimal. 
	 * 
	 * @uses ErrorPage
	 *
	 * @param int $statusCode HTTP Status Code (Default: 500)
	 * @param string $friendlyErrorMessage User-focused error message. Should not contain code pointers or "tech-speak".
	 *    Used in the HTTP Header and ajax responses.
	 * @param string $friendlyErrorDetail Detailed user-focused message. Is just used if no {@link ErrorPage} is found
	 *    for this specific status code.
	 * @return string HTML error message for non-ajax requests, plaintext for ajax-request.
	 */
	static function friendlyError($statusCode = 500, $friendlyErrorMessage = null, $friendlyErrorDetail = null) {
		if(!$friendlyErrorMessage) $friendlyErrorMessage = 'There has been an error';
		if(!$friendlyErrorDetail) $friendlyErrorDetail = 'The website server has not been able to respond to your request.';

		if(!headers_sent()) header($_SERVER['SERVER_PROTOCOL'] . " $statusCode $friendlyErrorMessage");

		if(Director::is_ajax()) {
			echo $friendlyErrorMessage;
		} else {
			if(file_exists(ASSETS_PATH . "/error-$statusCode.html")) {
				echo file_get_contents(ASSETS_PATH . "/error-$statusCode.html");
			} else {
				$renderer = new DebugView();
				$renderer->writeHeader();
				$renderer->writeInfo("Website Error", $friendlyErrorMessage, $friendlyErrorDetail);
				
				if(Email::getAdminEmail()) {
					$mailto = Email::obfuscate(Email::getAdminEmail());
					$renderer->writeParagraph('Contact an administrator: ' . $mailto . '');
				}

				$renderer->writeFooter();
			}
		}
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:39,代码来源:Debug.php

示例10: friendlyError

 /**
  * Render a user-facing error page, using the default HTML error template
  * rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link SS_HTTPResponse} class
  * the keep dependencies minimal.
  *
  * @uses ErrorPage
  *
  * @param int $statusCode HTTP Status Code (Default: 500)
  * @param string $friendlyErrorMessage User-focused error message. Should not contain code pointers
  *                                     or "tech-speak". Used in the HTTP Header and ajax responses.
  * @param string $friendlyErrorDetail Detailed user-focused message. Is just used if no {@link ErrorPage} is found
  *                                    for this specific status code.
  * @return string HTML error message for non-ajax requests, plaintext for ajax-request.
  */
 public static function friendlyError($statusCode = 500, $friendlyErrorMessage = null, $friendlyErrorDetail = null)
 {
     // Ensure the error message complies with the HTTP 1.1 spec
     if (!$friendlyErrorMessage) {
         $friendlyErrorMessage = Config::inst()->get('Debug', 'friendly_error_header');
     }
     $friendlyErrorMessage = strip_tags(str_replace(array("\n", "\r"), '', $friendlyErrorMessage));
     if (!$friendlyErrorDetail) {
         $friendlyErrorDetail = Config::inst()->get('Debug', 'friendly_error_detail');
     }
     if (!headers_sent()) {
         // Allow toggle between legacy behaviour and correctly setting HTTP response code
         // In 4.0 this should be fixed to always set this response code.
         if (Config::inst()->get('Debug', 'friendly_error_httpcode') || !Controller::has_curr()) {
             header($_SERVER['SERVER_PROTOCOL'] . " {$statusCode} {$friendlyErrorMessage}");
         }
     }
     if (Director::is_ajax()) {
         echo $friendlyErrorMessage;
     } else {
         if (!headers_sent()) {
             header('Content-Type: text/html');
         }
         if (class_exists('ErrorPage')) {
             $errorFilePath = ErrorPage::get_filepath_for_errorcode($statusCode, class_exists('Translatable') ? Translatable::get_current_locale() : null);
             if (file_exists($errorFilePath)) {
                 $content = file_get_contents($errorFilePath);
                 // $BaseURL is left dynamic in error-###.html, so that multi-domain sites don't get broken
                 echo str_replace('$BaseURL', Director::absoluteBaseURL(), $content);
             }
         } else {
             $renderer = new DebugView();
             $renderer->writeHeader();
             $renderer->writeInfo("Website Error", $friendlyErrorMessage, $friendlyErrorDetail);
             if (Email::config()->admin_email) {
                 $mailto = Email::obfuscate(Email::config()->admin_email);
                 $renderer->writeParagraph('Contact an administrator: ' . $mailto . '');
             }
             $renderer->writeFooter();
         }
     }
     return false;
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:57,代码来源:Debug.php

示例11: EmailObfuscated

 /**
  * Returns a representation of this text
  * with all email addresses converted into html character entities.
  * 
  * @return string
  */
 public function EmailObfuscated()
 {
     $content = $this->owner->forTemplate();
     $emailPattern = "/[A-Za-z0-9_-]+@[A-Za-z0-9_-]+\\.([A-Za-z0-9_-][A-Za-z0-9_]+)/";
     if (preg_match_all($emailPattern, $content, $matches)) {
         $searches = array();
         $replaces = array();
         for ($i = 0; $i < count($matches[0]); $i++) {
             $link = $matches[0][$i];
             $obfuscatedLink = Email::obfuscate($link, 'hex');
             array_push($searches, $link);
             array_push($replaces, $obfuscatedLink);
         }
         $content = str_replace($searches, $replaces, $content);
     }
     return $content;
 }
开发者ID:arillo,项目名称:silverstripe-cleanutilities,代码行数:23,代码来源:TextDataExtension.php


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