本文整理匯總了PHP中Messages::create_error_message方法的典型用法代碼示例。如果您正苦於以下問題:PHP Messages::create_error_message方法的具體用法?PHP Messages::create_error_message怎麽用?PHP Messages::create_error_message使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Messages
的用法示例。
在下文中一共展示了Messages::create_error_message方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Constructor.
*
* @param object $type
*/
public function __construct($type)
{
$this->type = $type;
parent::$hours = 12;
if (!isset(self::$options['gitlab_private_token'])) {
self::$options['gitlab_private_token'] = null;
}
if (!isset(self::$options['gitlab_enterprise_token'])) {
self::$options['gitlab_enterprise_token'] = null;
}
if (empty(self::$options['gitlab_private_token']) || empty(self::$options['gitlab_enterprise_token']) && !empty($type->enterprise)) {
Messages::create_error_message('gitlab');
}
add_site_option('github_updater', self::$options);
}
示例2: api
/**
* Call the API and return a json decoded body.
* Create error messages.
*
* @see http://developer.github.com/v3/
*
* @param string $url
*
* @return boolean|object
*/
protected function api($url)
{
$type = $this->return_repo_type();
$response = wp_remote_get($this->_get_api_url($url));
$code = (int) wp_remote_retrieve_response_code($response);
$allowed_codes = array(200, 404);
if (is_wp_error($response)) {
return false;
}
if (!in_array($code, $allowed_codes, false)) {
self::$error_code = array_merge(self::$error_code, array($this->type->repo => array('repo' => $this->type->repo, 'code' => $code, 'name' => $this->type->name)));
if ('github' === $type['repo']) {
GitHub_API::_ratelimit_reset($response, $this->type->repo);
}
Messages::create_error_message($type['repo']);
return false;
}
return json_decode(wp_remote_retrieve_body($response));
}