本文整理匯總了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);
}
}