本文整理汇总了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);
}
}
示例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);
}
}