本文整理汇总了PHP中cut_str函数的典型用法代码示例。如果您正苦于以下问题:PHP cut_str函数的具体用法?PHP cut_str怎么用?PHP cut_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cut_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Download
public function Download($link)
{
if (stristr($link, '/video/')) {
$link = str_replace('/video/', '/download/', $link);
} elseif (stristr($link, '/audio/')) {
$link = str_replace('/audio/', '/download/', $link);
}
$page = $this->GetPage($link);
//textarea($page, $cols, $rows, true);
is_present($page, '/file-404.html', 'File not found!');
$cookie = GetCookies($page);
$post = array('referer2' => cut_str($page, 'id="referer2" value="', '"'), 'download' => '1', 'imageField.x' => rand(0, 153), 'imageField.y' => rand(0, 25));
$page = $this->GetPage($link, $cookie, $post, $link);
$cookie = $cookie . "; " . GetCookies($page);
if (!preg_match('#here[|](\\d+)[|]class#', $page, $wait)) {
html_error('Error: Timer not found!');
}
$this->CountDown($wait[1]);
$dlink = cut_str($page, 'var link_enc=new Array(', ');');
$dlink = preg_replace('@[,\']@i', '', $dlink);
if (!isset($dlink)) {
html_error('Error: Download link not found!');
}
$filename = parse_url($dlink);
$FileName = basename($filename['path']);
$this->RedirectDownload($dlink, $FileName, $cookie, 0, $link);
}
示例2: Download
public function Download($link)
{
$cookie = 'lang=english';
$page = $this->GetPage($link, $cookie);
is_present($page, 'The file you were looking for could not be found, sorry for any inconvenience.');
$form = cut_str($page, '<form method="POST" action=\'\'>', '</form>');
if (!preg_match_all('/type="hidden" name="([^"]+)" value="([^"]+)?"/', $form, $one) || !preg_match_all('/type="submit" name="(\\w+_free)" .* value="([^"]+)"/', $form, $two)) {
html_error('Error[Form Post Data 1 not found!]');
}
$match = array_merge(array_combine($one[1], $one[2]), array_combine($two[1], $two[2]));
$post = array();
foreach ($match as $key => $value) {
$post[$key] = $value;
}
$page = $this->GetPage($link, $cookie, $post, $link);
$form = cut_str($page, '<Form name="F1" method="POST" action=""', '</Form>');
if (!preg_match_all('/type="hidden" name="([^"]+)" value="([^"]+)?"/', $form, $match)) {
html_error('Error[Post Data 2 not found!]');
}
$match = array_combine($match[1], $match[2]);
$post = array();
foreach ($match as $key => $value) {
$post[$key] = $value;
}
$page = $this->GetPage($link, $cookie, $post, $link);
if (!preg_match('/Location: (https?:\\/\\/[^\\r\\n]+)/i', $page, $dl)) {
html_error('Error[Download Link not found!]');
}
$dlink = trim($dl[1]);
$filename = basename(parse_url($dlink, PHP_URL_PATH));
$this->RedirectDownload($dlink, $filename, $cookie);
}
示例3: PrepareFree
private function PrepareFree($link)
{
$page = $this->GetPage($link);
is_present($page, "File Not Found", "The file you were looking for could not be found, sorry for any inconvenience.");
$id = cut_str($page, 'name="id" value="', '"');
$fname = cut_str($page, 'name="fname" value="', '"');
$post = array();
$post['op'] = "download1";
$post['usr_login'] = "";
$post['id'] = $id;
$post['fname'] = $fname;
$post['referer'] = $link;
$post['method_free'] = "Free Download";
$page = $this->GetPage($link, 0, $post, $link);
if (preg_match('%<span id="countdown">([0-9]+)</span>%', $page, $countd)) {
$this->CountDown($countd[1]);
}
$rand = cut_str($page, 'name="rand" value="', '"');
$temp = cut_str($page, '<img alt="captcha" src="', '" />');
$data = $this->DefaultParamArr($link, 0, $link);
$data['step'] = "1";
$data['id'] = $id;
$data['rand'] = $rand;
$this->EnterCaptcha($temp, $data);
exit;
}
示例4: Login
private function Login($link)
{
global $premium_acc;
$pA = !empty($_REQUEST['premium_user']) && !empty($_REQUEST['premium_pass']) ? true : false;
$user = $pA ? $_REQUEST['premium_user'] : $premium_acc['ultramegabit_com']['user'];
$pass = $pA ? $_REQUEST['premium_pass'] : $premium_acc['ultramegabit_com']['pass'];
if (empty($user) || empty($pass)) {
html_error('Login Failed: User or Password is empty. Please check login data.');
}
$purl = 'http://ultramegabit.com/';
$post = array();
$post['csrf_token'] = cut_str($this->page, 'name="csrf_token" value="', '"');
$post['submit'] = 'Login';
$post['return_url'] = urlencode($purl . 'user/details');
$post['username'] = urlencode($user);
$post['password'] = urlencode($pass);
$page = $this->GetPage($purl . 'login', $this->cookie, $post, $purl);
is_present($page, 'Invalid username or password', 'Login failed: User/Password incorrect.');
is_notpresent($page, "\r\nContent-Length: 0\r\n", 'Login failed.');
$this->cookie = GetCookiesArr($page);
$page = $this->GetPage($purl . 'user/details', $this->cookie, 0, $purl . 'login');
$this->page = $this->GetPage($link, $this->cookie);
if (stripos($page, '"Premium Member"') === false) {
$this->changeMesg(lang(300) . '<br /><b>Account isn\'t premium</b><br />Using it as member.');
return $this->FreeDL($link, true);
} else {
return $this->PremiumDL($link);
}
}
示例5: FreeDL
private function FreeDL()
{
$post = array('submit' => 'Download');
$page = $this->GetPage($this->link, $this->cookie, $post);
is_present($page, 'you can only download one file at a time');
$this->cookie = GetCookiesArr($page, $this->cookie);
if (preg_match($this->DLRegexp, $page, $dl)) {
return $this->RedirectDownload($dl[0], empty($dl[2]) ? 'T8_1f_f2' : urldecode(parse_url($dl[0], PHP_URL_PATH)));
}
is_present($page, 'you must wait between downloads', 'You must wait 15 minutes between downloads');
if (!preg_match('@[\\s,;]var\\s+count\\s*=\\s*(\\d+)\\s*;@i', $page, $cD)) {
html_error('Countdown not found.');
}
if ($cD[1] > 0) {
$this->CountDown($cD[1]);
}
$post = array();
$post['submit'] = cut_str($this->page, 'name="submit" value="', '"');
$post['t'] = cut_str($this->page, 'name="t" value="', '"');
if (empty($post['submit'])) {
$post['submit'] = 'Show the download link';
}
if (empty($post['t'])) {
html_error('Form data not found.');
}
$page = $this->GetPage($this->link, $this->cookie, $post);
$this->cookie = GetCookiesArr($page, $this->cookie);
if (!preg_match($this->DLRegexp, $page, $dl)) {
html_error('Download Link Not Found.');
}
return $this->RedirectDownload($dl[0], empty($dl[2]) ? 'T8_1f_f1' : urldecode(parse_url($dl[0], PHP_URL_PATH)));
}
示例6: get_list
function get_list($param)
{
$talk_list = array();
$lids = array();
$uids = array();
$guests = array();
$time = time();
extract($param);
$limit_sql = '';
$order_sql = '';
$where_sql = ' WHERE 1=1 ';
if ($where) {
$where_sql .= ' AND ' . $where;
}
if ($order) {
$order_sql .= $order;
}
if ($limit) {
$limit_sql = ' LIMIT ' . $limit;
}
$total_record = DB::result_first("SELECT COUNT(*) FROM " . DB::table('talk') . " {$where_sql}");
if ($total_record > 0) {
if ($param['perpage']) {
$page_arr = page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array'));
$limit_sql = $page_arr['limit'];
} else {
if ($param['limit']) {
$limit_sql = ' LIMIT ' . $param['limit'];
}
}
$query = DB::query("SELECT * FROM " . DB::table('talk') . " {$where_sql} {$order_sql} {$limit_sql}");
while ($value = DB::fetch($query)) {
if ($value['starttime'] > $time) {
$value['status_css'] = 'ico_notyet';
$value['status'] = '未开始';
} elseif ($value['endtime'] < $time) {
$value['status_css'] = 'ico_complete';
$value['status'] = '已完成';
} else {
$value['status_css'] = 'ico_ongoing';
$value['status'] = '进行中';
}
$value['datetime'] = date('Y-m-d H:i', $value['starttime']) . ' - ' . date('Y-m-d H:i', $value['endtime']);
if (date('Y-m-d', $value['starttime']) != date('Y-m-d', $value['endtime'])) {
$value['ldate'] = date('m-d H:i', $value['starttime']) . '—' . date('m-d H:i', $value['endtime']);
} else {
$value['ldate'] = date('Y-m-d H:i', $value['starttime']) . '-' . date('H:i', $value['endtime']);
}
$value['shortname'] = cut_str($value['talkname'], 18);
$talk_list[$value['lid']] = $value;
$lids[] = $value['lid'];
}
$guestall = $this->Getguest($lids);
foreach ($talk_list as $key => $val) {
$talk_list[$key] = array_merge($talk_list[$key], $guestall[$key]);
}
$info = array('list' => $talk_list, 'count' => $total_record, 'page' => $page_arr);
return $info;
}
}
示例7: GetMUSites
function GetMUSites($page = '')
{
global $cookie, $domain;
if (empty($page)) {
$page = geturl($domain, 80, "/", 0, $cookie);
is_page($page);
if (preg_match('@Location: http://([^/|\\r|\\n]+)/@i', $page, $rd)) {
$domain = $rd[1];
$page = geturl($domain, 80, "/", 0, $cookie);
is_page($page);
}
$cookie = GetCookiesArr($page);
}
if (!preg_match_all("@showdetails\\('(\\w+)'\\)@i", $page, $hosts)) {
html_error('Cannot Check Supported Sites [1]');
}
$sites = array();
foreach ($hosts[1] as $host) {
$popup = cut_str($page, 'id="details_' . $host . '">', '</div></div>');
if (empty($popup) || (!preg_match('@"(?:http://[^"]+/)?logos/(\\d+)\\.[^"]+"@i', $popup, $hid) || !preg_match('@Upload files directly into my ([^\\"|\'|\\<|\\:]+) account\\:@i', $popup, $name))) {
html_error("Cannot Check Supported Sites [2 ({$host})]");
}
$name[1] = trim($name[1]);
if ($hid[1] != 14) {
$sites[] = array('hname' => $name[1], 'id' => $hid[1], 'sname' => $host);
}
unset($popup, $hid, $name);
}
return $sites;
}
示例8: Download
public function Download($link)
{
if ($_REQUEST['step'] == '1') {
$post['captcha'] = $_POST['captcha'];
$post['submit'] = 'Download';
$dlink = urldecode($_POST['referer']);
$cookie = urldecode($_POST['cookie']);
$link = urldecode($_POST['link']);
$FileName = basename(parse_url($dlink, PHP_URL_PATH));
$this->RedirectDownload($dlink, $FileName, $cookie, $post, $link);
exit;
} else {
$page = $this->GetPage($link);
is_present($page, "File not found.");
$cookie = CookiesToStr(GetCookiesArr($page));
if (preg_match('%<a href="([^"]+)" class="ajax button button-devil">%', $page, $match)) {
$free = "http://download.hellshare.com" . $match[1];
}
$page = $this->GetPage($free, $cookie, 0, $link . "\r\nX-Requested-With: XMLHttpRequest");
is_present($page, "The server is under the maximum load.");
is_present($page, "You exceeded your today's limit for free download. You can download only 1 files per 24 hours.");
$postlink = str_replace("\\", "", cut_str($page, 'style=\\"margin-bottom:0\\" action=\\"', '\\" method=\\"POST\\">'));
$caplink = str_replace("\\", "", cut_str($page, 'id=\\"captcha-img\\"src=\\"', '\\" \\/>'));
$data = $this->DefaultParamArr($link, $cookie, $postlink);
$data['step'] = '1';
$this->EnterCaptcha($caplink, $data);
exit;
}
}
示例9: tpl_function_qishi_link
function tpl_function_qishi_link($params, &$smarty)
{
global $db, $_CFG;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "列表名":
$aset['listname'] = $a[1];
break;
case "显示数目":
$aset['row'] = $a[1];
break;
case "开始位置":
$aset['start'] = $a[1];
break;
case "文字长度":
$aset['len'] = $a[1];
break;
case "填补字符":
$aset['dot'] = $a[1];
break;
case "类型":
$aset['linktype'] = $a[1];
break;
case "调用名称":
$aset['alias'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
$aset['row'] = isset($aset['row']) ? intval($aset['row']) : 60;
$aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
$aset['len'] = isset($aset['len']) ? intval($aset['len']) : 8;
$aset['linktype'] = isset($aset['linktype']) ? intval($aset['linktype']) : 1;
$aset['dot'] = isset($aset['dot']) ? $aset['dot'] : '';
if ($aset['linktype'] == "1") {
$wheresql = " WHERE link_logo='' ";
} else {
$wheresql = " WHERE link_logo<>'' ";
}
$wheresql .= " AND display=1 ";
if (intval($_CFG['subsite_id']) > 0) {
$wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
}
if ($aset['alias']) {
$wheresql .= " AND alias='" . $aset['alias'] . "' ";
}
$limit = " LIMIT " . intval($aset['start']) . ',' . intval($aset['row']);
$result = $db->query("SELECT link_url,link_name,link_logo FROM " . table('link') . " " . $wheresql . " ORDER BY show_order DESC " . $limit);
$list = array();
while ($row = $db->fetch_array($result)) {
$row['title_'] = $row['link_name'];
$row['title'] = cut_str($row['link_name'], $aset['len'], 0, $aset['dot']);
$list[] = $row;
}
unset($arr, $str, $a, $params);
$smarty->assign($aset['listname'], $list);
}
示例10: Download
public function Download($link)
{
$page = $this->GetPage($link);
is_present($page, "This file no longer exists", 'Video not found or it was deleted.');
is_present($page, "The file is being transfered", 'Video is temporarily unavailable.');
if ($stepkey = cut_str($page, '"stepkey" value="', '"')) {
$post = array('stepkey' => $stepkey, 'submit' => 'submit');
$cookie = GetCookiesArr($page);
$page = $this->GetPage($link, $cookie, $post);
}
if (!preg_match('@<h4>\\s*([^"<>]+)\\s*</h4>@i', $page, $fname)) {
html_error('Error: Video title not found.');
}
if (!preg_match('@flashvars.domain="([^"]+)";\\s+flashvars.file="([^"]+)";\\s+flashvars.filekey=(?:"([^"]+)"|([\\$_A-Za-z][\\$\\w]*))@', $page, $matches)) {
html_error('Error: Download link not found.');
}
if (empty($matches[3])) {
if (!preg_match('@var\\s+' . $matches[4] . '\\s*=\\s*"([^"]+)"\\s*;@i', $page, $fkey)) {
html_error('FileKey not Found.');
}
$matches[3] = $fkey[1];
}
$url = $matches[1] . '/api/player.api.php?user=undefined&codes=1&file=' . $matches[2] . '&pass=undefined&key=' . urlencode($matches[3]);
$page2 = $this->GetPage($url);
if (!preg_match('@url=(http://[^&]+)@', $page2, $downl)) {
html_error('Error: Download link not found.');
}
if (!preg_match('@\\.[^\\.]+$@i', basename($downl[1]), $ext)) {
$ext = array('.flv');
}
$fname = preg_replace('@\\.(mp4|flv|mkv|webm|wmv|(m2)?ts|rm(vb)?|mpe?g?|vob|avi|[23]gp)$@i', '', str_replace(array("\\", "/", ":", "*", "?", "\"", "<", ">", "|"), "_", html_entity_decode(trim($fname[1])))) . $ext[0];
$this->RedirectDownload($downl[1], $fname, 0, 0, 0, $fname);
}
示例11: outlogin
function outlogin($skin_dir = "basic")
{
global $config, $member, $g4, $urlencode, $is_admin;
$nick = cut_str($member['mb_nick'], $config['cf_cut_name']);
$point = number_format($member['mb_point']);
$outlogin_skin_path = "{$g4['path']}/skin/outlogin/{$skin_dir}";
// 읽지 않은 쪽지가 있다면
if ($member['mb_id']) {
$sql = " select count(*) as cnt from {$g4['memo_table']} where me_recv_mb_id = '{$member['mb_id']}' and me_read_datetime = '0000-00-00 00:00:00' ";
$row = sql_fetch($sql);
$memo_not_read = $row['cnt'];
$is_auth = false;
$sql = " select count(*) as cnt from {$g4['auth_table']} where mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if ($row['cnt']) {
$is_auth = true;
}
}
ob_start();
if ($member['mb_id']) {
include_once "{$outlogin_skin_path}/outlogin.skin.2.php";
} else {
// 로그인 전이라면
include_once "{$outlogin_skin_path}/outlogin.skin.1.php";
}
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例12: Main
function Main()
{
$uid = MEMBER_ID;
if ($uid < 1) {
$this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login');
}
$member = jsg_member_info($uid);
$sql = "select * from `" . TABLE_PREFIX . "blacklist` where `uid` = '" . MEMBER_ID . "' ";
$query = $this->DatabaseHandler->Query($sql);
$uids = array();
while (false != ($row = $query->GetRow())) {
$uids[$row['touid']] = $row['touid'];
}
if ($uids) {
$where = "where `uid` in (" . jimplode($uids) . ")";
$member_list = $this->_MemberList($where);
if ($uids && MEMBER_ID > 0) {
$sql = "select `uid`,`tid`,`content`,`dateline` from `" . TABLE_PREFIX . "topic` where `uid` in (" . jimplode($uids) . ") group by `uid` order by `dateline` desc";
$query = $this->DatabaseHandler->Query($sql);
$topic_list = array();
while (false != ($row = $query->GetRow())) {
$row['content'] = cut_str($row['content'], 100);
$row['dateline'] = my_date_format2($row['dateline']);
$topic_list[] = $row;
}
}
}
$group_list = jlogic('buddy_follow_group')->get_my_group(MEMBER_ID);
$this->Title = '黑名单';
include template('social/blacklist');
}
示例13: INITParameter_all
private function INITParameter_all($payment, $parameter)
{
$this->api()->hd('request')->setParameter("partner", $payment['config']['bargainor']);
$this->api()->hd('request')->setParameter("out_trade_no", $parameter['sign']);
$this->api()->hd('request')->setParameter("total_fee", $parameter['price'] * 100);
$this->api()->hd('request')->setParameter("return_url", $parameter['notify_url']);
$this->api()->hd('request')->setParameter("notify_url", $parameter['notify_url']);
$this->api()->hd('request')->setParameter("body", cut_str($parameter['detail'], 88));
$this->api()->hd('request')->setParameter("bank_type", 'DEFAULT');
$this->api()->hd('request')->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']);
$this->api()->hd('request')->setParameter("fee_type", "1");
$this->api()->hd('request')->setParameter("subject", $parameter['name']);
$this->api()->hd('request')->setParameter("sign_type", "MD5");
$this->api()->hd('request')->setParameter("service_version", "1.0");
$this->api()->hd('request')->setParameter("input_charset", ini('settings.charset'));
$this->api()->hd('request')->setParameter("sign_key_index", "1");
$this->api()->hd('request')->setParameter("attach", "");
$this->api()->hd('request')->setParameter("product_fee", "");
$this->api()->hd('request')->setParameter("transport_fee", "0");
$this->api()->hd('request')->setParameter("time_start", date("YmdHis"));
$this->api()->hd('request')->setParameter("time_expire", "");
$this->api()->hd('request')->setParameter("buyer_id", "");
$this->api()->hd('request')->setParameter("goods_tag", "");
$this->api()->hd('request')->setParameter("transport_desc","");
$this->api()->hd('request')->setParameter("trans_type","1");
$this->api()->hd('request')->setParameter("agentid","");
$this->api()->hd('request')->setParameter("agent_type","");
$this->api()->hd('request')->setParameter("seller_id","");
if ($payment['config']['service'] == 'direct')
{
$this->api()->hd('request')->setParameter("trade_mode", 1); }
if ($payment['config']['service'] == 'medi')
{
$this->api()->hd('request')->setParameter("trade_mode", 2); }
}
示例14: DownloadFree
private function DownloadFree($link)
{
$post = array();
$post['op'] = "download2";
$post['id'] = $_POST['id'];
$post['rand'] = $_POST['rand'];
$post['referer'] = urldecode($_POST['referer']);
$post['method_free'] = "Free Download";
$post['method_premium'] = "";
$post['code'] = $_POST['captcha'];
$post['down_script'] = "1";
$link = $_POST['link'];
$page = $this->GetPage($link, 0, $post, $link);
if (strpos($page, "Wrong captcha")) {
return $this->Retrieve($link);
}
if (!stristr($page, "Location:")) {
html_error("Sorry, download link couldn't be found. Contact the author n give the link which u have this error!");
}
$dlink = trim(cut_str($page, "Location: ", "\n"));
$Url = parse_url($dlink);
$FileName = basename($Url['path']);
$this->RedirectDownload($dlink, $FileName, 0, 0, $link);
exit;
}
示例15: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', esc_attr($instance['title']));
$limit = strip_tags($instance['limit']);
$email = strip_tags($instance['email']);
echo $before_widget . $before_title . $title . $after_title;
?>
<ul>
<?php
global $wpdb;
$limit_num = $limit;
$my_email = "'" . $email . "'";
$rc_comms = $wpdb->get_results("SELECT ID, post_title, comment_ID, comment_author,comment_author_email,comment_date,comment_content FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' AND comment_author_email != {$my_email} ORDER BY comment_date_gmt DESC LIMIT {$limit_num} ");
$rc_comments = '';
foreach ($rc_comms as $rc_comm) {
$rc_comments .= "<li>" . $rc_comm->comment_author . ": <a href='" . get_permalink($rc_comm->ID) . "#comment-" . $rc_comm->comment_ID . "' title='在 " . $rc_comm->post_title . " 发表的评论'>" . cut_str(strip_tags($rc_comm->comment_content), 20) . "</a></li>\n";
}
echo $rc_comments;
?>
</ul>
<?php
echo $after_widget;
}