$code, 'msg' => $msg, 'status' => 1 )); break; case 'check_url': $page = input('page', 1); $url = input('url'); $str = Fcurl($url); $count_str = ''; $data = ''; $list = array(array(), array(), 0); if ($str) { preg_match_all('//is', $str, $ahref); $aLink = []; $title = preg_replace("/.*(.*?)<\/title>.*/is", '\\1', $str); $url_p = 'http://' . preg_replace("/(http[s]?:)?(\/\/)?([\w.]+)[\w\/]*[\w.]*\??[\w=&\+\%]*/is", '\\3', $url); $id = 1; $aLink[] = array( 'url' => $url_p, 'title' => $title, 'id' => $id ); $arr = array(); foreach ($ahref['1'] as $key => $vo) { $qdiv = substr($vo, 0, 1) != '#' && $vo != '/' && substr($vo, 0, 11) != 'javascript:'; if ($qdiv && $vo != $url_p && !in_array($vo, $arr)) { $arr[] = $vo; if (substr($vo, 0, 2) == '//') { ++$id; $aLink[] = array( 'url' => 'http:' . $vo, 'title' => '', 'id' => $id ); } else if (substr($vo, 0, 4) == 'http') { ++$id; $aLink[] = array( 'url' => $vo, 'title' => '', 'id' => $id ); } else { if (substr($vo, 0, 1) == '/') { ++$id; $aLink[] = array( 'url' => $url_p . $vo, 'title' => '', 'id' => $id ); } else { ++$id; $aLink[] = array( 'url' => $url_p . '/' . $vo, 'title' => '', 'id' => $id ); } } } } $list = page($aLink, 20, $page); for ($i = 1; $i <= $list['1']; $i++) { $count_str .= '<li class="page-number "><a href="javascript:;" style="' . ($i == $page ? 'background:#ccc' : '') . '" onclick="get_data(' . $i . ')">' . $i . '</a></li>'; } foreach ($list['0'] as $key => $vo) { $data .= '<tr class=""><td class="order">' . $vo['id'] . '</td><td class="title" id="tr_title_' . $vo['id'] . '">' . ($vo['title'] ? $vo['title'] : ' - ') . '</td><td class="owner" style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;"><a class="green" href="' . $vo['url'] . '" target="_blank">' . $vo['url'] . '</a></td><td class="title" id="tr_' . $vo['id'] . '"> - </td></tr>'; } } json(array( 'status' => $str ? 1 : 0, 'data' => $data, 'obj' => $list['0'], 'total_count' => $list['2'], 'count_str' => $count_str )); break; case 'single_url': $url = input('url'); $str = ''; if ($url) { $str = urltitlecode($url); } json($str); break; case 'camelcase': $id = input('id'); $text = input('text'); if ($id == 2) { $text = preg_replace_callback('/([^a-zA-Z][a-z])/', function ($m) { $str = str_replace('_', '', $m[0]); return strtoupper($str); }, ucfirst($text)); } else { $text = preg_replace_callback('/(([A-Z]).*?([A-Z]))/', function ($m) { $str = str_replace($m['3'], '_' . $m['3'], $m[0]); return $str; }, ucfirst($text)); $text = strtolower($text); } $data = array(); $data['status'] = $text ? 1 : 0; $data['msg'] = $text; json($data); break; default: /*$ifpost = 0; $datafields = ''; $post = input('post.'); if ($post) { $ifpost = 1; $datafields = http_build_query($post); } $url = 'http://www.pcjson.com' . $_SERVER['REQUEST_URI']; $str = Fcurl($url, $ifpost, $datafields); return json_decode($str, true);*/ json(array( 'status' => 1, 'msg' => null )); }