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


PHP WP_Error::get_error_data方法代码示例

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


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

示例1: is_service_unavailable

 /**
  * Whether the job result indicates that the service is unavailable and will return.
  *
  * @since 1.4.10
  *
  * @return boolean
  */
 protected function is_service_unavailable()
 {
     $data = is_wp_error($this->job_result) ? $this->job_result->get_error_data() : $this->job_result;
     if (!is_array($data)) {
         return false;
     }
     if (!isset($data['response']['code'])) {
         return false;
     }
     return 503 == $data['response']['code'];
 }
开发者ID:postmatic,项目名称:beta-dist,代码行数:18,代码来源:rescheduler.php

示例2: get_error_messages

 /**
  * Retrieves a string for error messages.
  *
  * @since 4.6.0
  * @access public
  *
  * @return string Error messages during an upgrade.
  */
 public function get_error_messages()
 {
     $messages = array();
     foreach ($this->errors->get_error_codes() as $error_code) {
         if ($this->errors->get_error_data($error_code) && is_string($this->errors->get_error_data($error_code))) {
             $messages[] = $this->errors->get_error_message($error_code) . ' ' . esc_html(strip_tags($this->errors->get_error_data($error_code)));
         } else {
             $messages[] = $this->errors->get_error_message($error_code);
         }
     }
     return implode(', ', $messages);
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:20,代码来源:class-wp-ajax-upgrader-skin.php

示例3:

 /**
  * @ticket 28092
  */
 function test_remove_error()
 {
     $error = new WP_Error();
     $error->add('foo', 'This is the first error message', 'some error data');
     $error->add('foo', 'This is the second error message');
     $error->add('bar', 'This is another error');
     $error->remove('foo');
     // Check the error has been removed.
     $this->assertEmpty($error->get_error_data('foo'));
     $this->assertEmpty($error->get_error_messages('foo'));
     // The 'bar' error should now be the 'first' error retrieved.
     $this->assertEquals('bar', $error->get_error_code());
     $this->assertEmpty($error->get_error_data());
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:17,代码来源:errors.php

示例4: fourtwo_ppe_validateComplexPassword

/**
 * validate complex password
 *
 * @author  Joe Sexton <joe.@webtipblog.com>
 * @param   WP_Error $errors
 * @param   stdClass $userData
 * @return  WP_Error
 */
function fourtwo_ppe_validateComplexPassword($errors)
{
    $password = isset($_POST['pass1']) && trim($_POST['pass1']) ? $_POST['pass1'] : null;
    // no password or already has password error
    if (empty($password) || $errors->get_error_data('pass')) {
        return $errors;
    }
    $pass = fourtwo_ppe_isStrongPassword($password);
    // validate
    if (!$pass['length']) {
        $errors->add('pass', '<strong>ERROR</strong>: Your password must contain at least eight (8) characters.');
    }
    if (!$pass['num']) {
        $errors->add('pass', '<strong>ERROR</strong>: Your password must contain at least one (1) number.');
    }
    if (!$pass['alpha']) {
        $errors->add('pass', '<strong>ERROR</strong>: Your password must contain at least one (1) letter.');
    }
    if (!$pass['upper']) {
        $errors->add('pass', '<strong>ERROR</strong>: Your password must contain at least one (1) uppercase letter.');
    }
    if (!$pass['lower']) {
        $errors->add('pass', '<strong>ERROR</strong>: Your password must contain at least one (1) lowercase letter.');
    }
    if (!$pass['special']) {
        $errors->add('pass', '<strong>ERROR</strong>: Your password must contain at least one (1) special character.');
    }
    return $errors;
}
开发者ID:42Web,项目名称:FourTwo-Password-Policy-Enforcement,代码行数:37,代码来源:fourtwo-password-policy-enforcement.php

示例5: login_header

function login_header($title = 'Login', $message = '', $wp_error = '') {
	global $error;

	if ( empty($wp_error) )
		$wp_error = new WP_Error();
	?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
	<title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
	<?php
	wp_admin_css( 'css/login' );
	wp_admin_css( 'css/colors-fresh' );
	?>
	<script type="text/javascript">
		function focusit() {
			document.getElementById('user_login').focus();
		}
		window.onload = focusit;
	</script>
<?php do_action('login_head'); ?>
</head>
<body class="login">

<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
<?php
	if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";

	// Incase a plugin uses $error rather than the $errors object
	if ( !empty( $error ) ) {
		$wp_error->add('error', $error);
		unset($error);
	}

	if ( $wp_error->get_error_code() ) {
		$errors = '';
		$messages = '';
		foreach ( $wp_error->get_error_codes() as $code ) {
			$severity = $wp_error->get_error_data($code);
			foreach ( $wp_error->get_error_messages($code) as $error ) {
				if ( 'message' == $severity )
					$messages .= '	' . $error . "<br />\n";
				else
					$errors .= '	' . $error . "<br />\n";
			}
		}
		if ( !empty($errors) )
			echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
		if ( !empty($messages) )
			echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
	}
} // End of login_header()
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:53,代码来源:wp-login.php

示例6: importErrors

 /**
  * Merge errors from another WP_Error object into the one dedicated to this model object.
  *
  * @param  \WP_Error  $otherErrors
  */
 protected function importErrors(\WP_Error $otherErrors)
 {
     foreach ($otherErrors->get_error_codes() as $code) {
         $errors = $otherErrors->get_error_messages($code);
         $data = $otherErrors->get_error_data($code);
         for ($i = 0; $i < max(count($errors), count($data)); $i++) {
             if (array_key_exists($i, $errors)) {
                 $data = array_key_exists($i, $data) ? $data[$i] : null;
                 $this->errors->add($code, $errors[$i], $data);
             }
         }
     }
 }
开发者ID:asmbs,项目名称:wp-schedule-builder,代码行数:18,代码来源:AbstractModel.php

示例7: login_header

/**
 * Outputs the header for the login page.
 *
 * @uses do_action() Calls the 'login_head' for outputting HTML in the Log In
 *		header.
 * @uses apply_filters() Calls 'login_headerurl' for the top login link.
 * @uses apply_filters() Calls 'login_headertitle' for the top login title.
 * @uses apply_filters() Calls 'login_message' on the message to display in the
 *		header.
 * @uses $error The error global, which is checked for displaying errors.
 *
 * @param string $title Optional. WordPress Log In Page title to display in
 *		<title/> element.
 * @param string $message Optional. Message to display in header.
 * @param WP_Error $wp_error Optional. WordPress Error Object
 */
function login_header($title = 'Log In', $message = '', $wp_error = '')
{
    global $error, $is_iphone, $current_site;
    // Don't index any of these forms
    add_filter('pre_option_blog_public', create_function('$a', 'return 0;'));
    add_action('login_head', 'noindex');
    if (empty($wp_error)) {
        $wp_error = new WP_Error();
    }
    ?>


<div id="login">
<?php 
    $message = apply_filters('login_message', $message);
    if (!empty($message)) {
        echo $message . "\n";
    }
    // Incase a plugin uses $error rather than the $errors object
    if (!empty($error)) {
        $wp_error->add('error', $error);
        unset($error);
    }
    if ($wp_error->get_error_code()) {
        $errors = '';
        $messages = '';
        foreach ($wp_error->get_error_codes() as $code) {
            $severity = $wp_error->get_error_data($code);
            foreach ($wp_error->get_error_messages($code) as $error) {
                if ('message' == $severity) {
                    $messages .= '	' . $error . "<br />\n";
                } else {
                    $errors .= '	' . $error . "<br />\n";
                }
            }
        }
        if (!empty($errors)) {
            echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
        }
        if (!empty($messages)) {
            echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
        }
    }
}
开发者ID:jinpingv,项目名称:website_wrapper,代码行数:60,代码来源:wp-login-pj.php

示例8: extract

 function simplelogin_header($title, $message = '', $wp_error = '', $args = '')
 {
     global $error;
     extract($args);
     if (empty($wp_error)) {
         $wp_error = new WP_Error();
     }
     if (!empty($error)) {
         $wp_error->add('error', $error);
         unset($error);
     }
     echo $before_widget . $before_title . __($title, 'simplelogin') . $after_title . "\n";
     echo '<div id="login">';
     if (!empty($message)) {
         echo apply_filters('login_message', $message) . "\n";
     }
     if ($wp_error->get_error_code()) {
         $errors = '';
         $messages = '';
         foreach ($wp_error->get_error_codes() as $code) {
             $severity = $wp_error->get_error_data($code);
             foreach ($wp_error->get_error_messages($code) as $error) {
                 if ('message' == $severity) {
                     $messages .= '    ' . $error . "<br />\n";
                 } else {
                     $errors .= '    ' . $error . "<br />\n";
                 }
             }
         }
         if (!empty($errors)) {
             echo '<p class="error">' . apply_filters('login_errors', $errors) . "</p>\n";
         }
         if (!empty($messages)) {
             echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
         }
     }
 }
开发者ID:slaFFik,项目名称:l10n-ru,代码行数:37,代码来源:wp-login-functions.php

示例9: wpmp_switcher_login_header

function wpmp_switcher_login_header($title, $message = '', $wp_error = '')
{
    global $error;
    if (empty($wp_error)) {
        $wp_error = new WP_Error();
    }
    include_once 'mobile.php';
    wpmp_ms_mobile_top($title);
    if (!empty($message)) {
        echo apply_filters('login_message', $message) . "\n";
    }
    if (!empty($error)) {
        $wp_error->add('error', $error);
        unset($error);
    }
    if ($wp_error->get_error_code()) {
        $errors = '';
        $messages = '';
        foreach ($wp_error->get_error_codes() as $code) {
            $severity = $wp_error->get_error_data($code);
            foreach ($wp_error->get_error_messages($code) as $error) {
                if ('message' == $severity) {
                    $messages .= '	' . $error . "<br />\n";
                } else {
                    $errors .= '	' . $error . "<br />\n";
                }
            }
        }
        if (!empty($errors)) {
            echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
        }
        if (!empty($messages)) {
            echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
        }
    }
}
开发者ID:nil-vn,项目名称:beautysite,代码行数:36,代码来源:mobile_login.php

示例10: login_header

/**
 * Outputs the header for the login page.
 *
 * @uses do_action() Calls the 'login_head' for outputting HTML in the Log In
 *		header.
 * @uses apply_filters() Calls 'login_headerurl' for the top login link.
 * @uses apply_filters() Calls 'login_headertitle' for the top login title.
 * @uses apply_filters() Calls 'login_message' on the message to display in the
 *		header.
 * @uses $error The error global, which is checked for displaying errors.
 *
 * @param string $title Optional. WordPress Log In Page title to display in
 *		<title/> element.
 * @param string $message Optional. Message to display in header.
 * @param WP_Error $wp_error Optional. WordPress Error Object
 */
function login_header($title = 'Log In', $message = '', $wp_error = '') {
	global $error, $is_iphone, $interim_login, $current_site;

	// Don't index any of these forms
	add_filter( 'pre_option_blog_public', '__return_zero' );
	add_action( 'login_head', 'noindex' );

	if ( empty($wp_error) )
		$wp_error = new WP_Error();

	// Shake it!
	$shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
	$shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );

	if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
		add_action( 'login_head', 'wp_shake_js', 12 );

	?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
	<title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<?php
	wp_admin_css( 'login', true );
	wp_admin_css( 'colors-fresh', true );

	if ( $is_iphone ) { ?>
	<meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
	<style type="text/css" media="screen">
	form { margin-left: 0px; }
	#login { margin-top: 20px; }
	</style>
<?php
	} elseif ( isset($interim_login) && $interim_login ) { ?>
	<style type="text/css" media="all">
	.login #login { margin: 20px auto; }
	</style>
<?php
	}

	do_action('login_head'); ?>
</head>
<body class="login">
<?php   if ( !is_multisite() ) { ?>
<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
<?php   } else { ?>
<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', network_home_url() ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1>
<?php   }

	$message = apply_filters('login_message', $message);
	if ( !empty( $message ) ) echo $message . "\n";

	// Incase a plugin uses $error rather than the $errors object
	if ( !empty( $error ) ) {
		$wp_error->add('error', $error);
		unset($error);
	}

	if ( $wp_error->get_error_code() ) {
		$errors = '';
		$messages = '';
		foreach ( $wp_error->get_error_codes() as $code ) {
			$severity = $wp_error->get_error_data($code);
			foreach ( $wp_error->get_error_messages($code) as $error ) {
				if ( 'message' == $severity )
					$messages .= '	' . $error . "<br />\n";
				else
					$errors .= '	' . $error . "<br />\n";
			}
		}
		if ( !empty($errors) )
			echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
		if ( !empty($messages) )
			echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
	}
} // End of login_header()
开发者ID:realfluid,项目名称:umbaugh,代码行数:93,代码来源:wp-login.php

示例11: get_wp_error_string

 /**
  * Retrieve all information of a WP_Error object as a string.
  *
  * @since 1.4.0
  *
  * @param WP_Error $wp_error A WP_Error object.
  * @return string All error codes, messages, and data of the WP_Error.
  */
 protected function get_wp_error_string($wp_error)
 {
     $error_strings = array();
     $error_codes = $wp_error->get_error_codes();
     // Reverse order to get latest errors first.
     $error_codes = array_reverse($error_codes);
     foreach ($error_codes as $error_code) {
         $error_strings[$error_code] = $error_code;
         $error_messages = $wp_error->get_error_messages($error_code);
         $error_messages = implode(', ', $error_messages);
         if (!empty($error_messages)) {
             $error_strings[$error_code] .= " ({$error_messages})";
         }
         $error_data = $wp_error->get_error_data($error_code);
         if (!is_null($error_data)) {
             $error_strings[$error_code] .= " [{$error_data}]";
         }
     }
     return implode(";\n", $error_strings);
 }
开发者ID:pedro-mendonca,项目名称:TablePress,代码行数:28,代码来源:controller-admin_ajax.php

示例12: log_error

 /**
  * Log an error instance to the logger.
  *
  * @param WP_Error $error Error instance to log.
  */
 protected function log_error(WP_Error $error)
 {
     $this->logger->warning($error->get_error_message());
     // Log the data as debug info too
     $data = $error->get_error_data();
     if (!empty($data)) {
         $this->logger->debug(var_export($data, true));
     }
 }
开发者ID:kucrut,项目名称:WordPress-Importer,代码行数:14,代码来源:class-wxr-importer.php

示例13: report_error

 /**
  * Redirect to the application URL with errors returned in the Authorization
  * Code grant.
  *
  * @since 1.0.0
  *
  * @param  WP_Error $error Error.
  */
 protected function report_error(WP_Error $error)
 {
     $url = $this->get_application_url(array('error' => $error->get_error_code(), 'error_description' => urlencode($error->get_error_message()), 'error_uri' => urlencode($error->get_error_data('error_uri'))));
     wp_safe_redirect($url);
     exit;
 }
开发者ID:audiotheme,项目名称:audiotheme-agent,代码行数:14,代码来源:Client.php

示例14: log

 /**
  * Log a message about the syncing process.
  *
  * @param  WP_Error $error While the message may not be an "error" per se,
  *                         this uses WP_Error to keep organized.
  */
 public function log(WP_Error $error)
 {
     if (defined('WP_CLI') && WP_CLI) {
         $method = $error->get_error_code();
         if (!in_array($method, array('success', 'warning', 'error'))) {
             $method = 'line';
         }
         $message = $error->get_error_data() ? $error->get_error_message() . "; Data: " . json_encode($error->get_error_data()) : $error->get_error_message();
         call_user_func(array('WP_CLI', $method), $message);
         $this->data['messages'][$error->get_error_code()][] = $message;
     } else {
         $this->data['messages'][$error->get_error_code()][] = $error->get_error_message();
         set_transient($this->error_transient, true);
         if (!$this->data['running']) {
             $this->save();
         }
     }
 }
开发者ID:dfmedia,项目名称:searchpress,代码行数:24,代码来源:class-sp-sync-meta.php

示例15: prepare_errors_for_response

 /**
  * Prepare a WP_Error for sending to JS.
  *
  * @param \WP_Error $error Error.
  * @return array
  */
 public function prepare_errors_for_response(\WP_Error $error)
 {
     $exported_errors = array();
     foreach ($error->errors as $code => $messages) {
         $exported_errors[$code] = array('message' => join(' ', $messages), 'data' => $error->get_error_data($code));
     }
     return $exported_errors;
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:14,代码来源:class-customize-snapshot-manager.php


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