本文整理汇总了PHP中Check::getDomainFromURLString方法的典型用法代码示例。如果您正苦于以下问题:PHP Check::getDomainFromURLString方法的具体用法?PHP Check::getDomainFromURLString怎么用?PHP Check::getDomainFromURLString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Check
的用法示例。
在下文中一共展示了Check::getDomainFromURLString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store_check
public function store_check($input_arr = array())
{
$input_arr['action'] = 'creating';
if (!$this->validate($input_arr)) {
//$this->format_error_messages($input_arr['type'],($input_arr['type'] == 'dns') ? $input_arr['host'] : $input_arr['url'], 'creating');
return false;
}
$option = isset($input_arr['edit_options']) && $input_arr['edit_options'] == 'change' ? $input_arr['options'] : ($option = json_encode(array('phrases_to_match' => $input_arr['phrases'], 'post_body' => $input_arr['post_body'], 'url_path' => Check::getPathFromURLString($input_arr['url']))));
$this->user_id = intval($input_arr['user_id']);
$this->url = $input_arr['type'] == 'https' ? str_replace('http://', 'https://', $input_arr['url']) : $input_arr['url'];
$this->domain = Check::getDomainFromURLString($input_arr['url']);
$this->type = $input_arr['type'];
$this->host = $this->type == 'dns' ? $input_arr['host'] : '';
$this->options = $option;
$this->create_time = time();
//Log::info("Json error:".json_last_error().' '.JSON_ERROR_NONE);
if ($this->save()) {
$MongoAPI = new MongoAPI();
$this->mongo_id = $MongoAPI->saveSiteInfoToMongo($this->type, 'KUU-' . $this->user_id . '-' . $this->check_id, $this->domain . (($s = Check::getPathFromURLString($this->url)) != 'Homepage' ? '/' . $s : ''), $this->get_match());
if ($this->mongo_id && $this->save()) {
return true;
} else {
array_push($this->validate_errors, 'Check information was not saved.');
$this->delete();
return false;
}
} else {
array_push($this->validate_errors, 'Check information was not saved.');
return false;
}
}
示例2: postAddSiteInfoAuto
public function postAddSiteInfoAuto()
{
$input = \Input::all();
$error_messages = array();
$types = array('http', 'https', 'dns');
$i = 0;
foreach ($types as $type) {
$parameters = array('type' => $type, 'url' => $input['url'], 'edit_options' => 'change', 'options' => '', 'host' => $type == 'dns' ? gethostbyname(Check::getDomainFromURLString($input['url'])) : '');
$check = new Check();
if (!$check->user_store_check($parameters)) {
$error_messages = array_merge($error_messages, $check->validate_errors);
} else {
$i++;
$mess = $this->user_save_check_alert_emails($check->check_id);
if ($i == 1) {
foreach ($mess as $error_message) {
array_push($error_messages, $error_message);
}
}
}
}
Session::flash('error_messages', $error_messages);
$user_check_count = Check::get_user_check()->count();
return Response::json(array('status' => 'OK', 'is_add_enable' => $user_check_count < $this->check_create_limit_num ? true : false));
}