本文整理汇总了PHP中EE_Error::has_notices方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Error::has_notices方法的具体用法?PHP EE_Error::has_notices怎么用?PHP EE_Error::has_notices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Error
的用法示例。
在下文中一共展示了EE_Error::has_notices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verify_default_pages_exist
/**
* verify_default_pages_exist
*
* @access public
* @static
* @return void
*/
public static function verify_default_pages_exist()
{
$critical_page_problem = FALSE;
$critical_pages = array(array('id' => 'reg_page_id', 'name' => __('Registration Checkout', 'event_espresso'), 'post' => NULL, 'code' => 'ESPRESSO_CHECKOUT'), array('id' => 'txn_page_id', 'name' => __('Transactions', 'event_espresso'), 'post' => NULL, 'code' => 'ESPRESSO_TXN_PAGE'), array('id' => 'thank_you_page_id', 'name' => __('Thank You', 'event_espresso'), 'post' => NULL, 'code' => 'ESPRESSO_THANK_YOU'), array('id' => 'cancel_page_id', 'name' => __('Registration Cancelled', 'event_espresso'), 'post' => NULL, 'code' => 'ESPRESSO_CANCELLED'));
foreach ($critical_pages as $critical_page) {
// is critical page ID set in config ?
if (EE_Registry::instance()->CFG->core->{$critical_page}['id'] !== FALSE) {
// attempt to find post by ID
$critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->{$critical_page}['id']);
}
// no dice?
if ($critical_page['post'] == NULL) {
// attempt to find post by title
$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
// still nothing?
if ($critical_page['post'] == NULL) {
$critical_page = EEH_Activation::create_critical_page($critical_page);
// REALLY? Still nothing ??!?!?
if ($critical_page['post'] == NULL) {
$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
break;
}
}
}
// track post_shortcodes
if ($critical_page['post']) {
EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
}
// check that Post ID matches critical page ID in config
if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->{$critical_page}['id']) {
//update Config with post ID
EE_Registry::instance()->CFG->core->{$critical_page}['id'] = $critical_page['post']->ID;
if (!EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
}
}
$critical_page_problem = !isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem;
}
if ($critical_page_problem) {
$msg = sprintf(__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>');
EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
}
if (EE_Error::has_notices()) {
EE_Error::get_notices(FALSE, TRUE, TRUE);
}
}
示例2: _set_error_message
/**
* This sets any necessary error messages on the message object and its status to failed.
* @param EE_Message $message
* @param array $error_messages the response from the messenger.
*/
protected function _set_error_message(EE_Message $message, $error_messages)
{
$error_messages = (array) $error_messages;
if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending())) {
$notices = EE_Error::has_notices();
$error_messages[] = __('Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso');
if ($notices === 1) {
$notices = EE_Error::get_vanilla_notices();
$notices['errors'] = isset($notices['errors']) ? $notices['errors'] : array();
$error_messages[] = implode("\n", $notices['errors']);
}
}
if (count($error_messages) > 0) {
$msg = __('Message was not executed successfully.', 'event_espresso');
$msg = $msg . "\n" . implode("\n", $error_messages);
$message->set_error_message($msg);
}
}