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


PHP EE_Error::generate_error_code方法代码示例

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


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

示例1: _add_notice

 /**
  * 	add success message
  *
  *	@access public
  * 	@param		string		$type	whether the message is for a success or error notification
  * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
  * 	@param		string		$file		the file that the error occurred in - just use __FILE__
  * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
  * 	@param		string		$line	the line number where the error occurred - just use __LINE__
  * 	@return 		void
  */
 private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL)
 {
     if (empty($msg)) {
         EE_Error::doing_it_wrong('EE_Error::add_' . $type . '()', sprintf(__('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), $type, $file, $line), EVENT_ESPRESSO_VERSION);
     }
     if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
         EE_Error::doing_it_wrong('EE_Error::add_error()', __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), EVENT_ESPRESSO_VERSION);
     }
     // get separate user and developer messages if they exist
     $msg = explode('||', $msg);
     $user_msg = $msg[0];
     $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
     $msg = WP_DEBUG ? $dev_msg : $user_msg;
     // add notice if message exists
     if (!empty($msg)) {
         // get error code
         $notice_code = EE_Error::generate_error_code($file, $func, $line);
         if (WP_DEBUG && $type == 'errors') {
             $msg .= '<br/><span class="tiny-text">' . $notice_code . '</span>';
         }
         // add notice. Index by code if it's not blank
         if ($notice_code) {
             self::$_espresso_notices[$type][$notice_code] = $msg;
         } else {
             self::$_espresso_notices[$type][] = $msg;
         }
         add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
     }
 }
开发者ID:adrianjonmiller,项目名称:hearts-being-healed,代码行数:40,代码来源:EE_Error.core.php

示例2: _add_notice

 /**
  * 	add success message
  *
  *	@access public
  * 	@param		string		$type	whether the message is for a success or error notification
  * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
  * 	@param		string		$file		the file that the error occurred in - just use __FILE__
  * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
  * 	@param		string		$line	the line number where the error occurred - just use __LINE__
  * 	@return 		void
  */
 private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL)
 {
     if (empty($msg)) {
         EE_Error::doing_it_wrong('EE_Error::add_' . $type . '()', 'Notifications are not much use without a message! Please add a message.', EVENT_ESPRESSO_VERSION);
     }
     // todo: reimplement  the following in 4.5+
     //		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
     //			EE_Error::doing_it_wrong( 'EE_Error::add_error()', 'You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', EVENT_ESPRESSO_VERSION );
     //		}
     // get separate user and developer messages if they exist
     $msg = explode('||', $msg);
     $user_msg = $msg[0];
     $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
     $msg = WP_DEBUG ? $dev_msg : $user_msg;
     // add notice if message exists
     if (!empty($msg)) {
         // get error code only on error
         $error_code = $type == 'errors' ? EE_Error::generate_error_code($file, $func, $line) : '';
         $error_code = !empty($error_code) ? '<br/><span class="tiny-text">' . $error_code . '</span>' : '';
         // add notice
         self::$_espresso_notices[$type][] = $msg . $error_code;
         add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
     }
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:35,代码来源:EE_Error.core.php


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