function loadClass($className) { global $CONFIG; if (0 == strpos($className, 'Twig')) { $file = $CONFIG['CENTRAL_PATH'] . 'vendor/Twig/lib/' . str_replace(array('_', ""), array('/', ''), $className) . '.php'; if (is_file($file)) { require $file; return; } } $fileName = getFileName($className); require getFullPath($fileName); }
function getParseListInfo($html) { preg_match('#<div id="videoData" class="jsonPP boxList"><ul>(.+)</ul>#Uis', $html, $match); $html = isset($match[1]) ? $match[1] : ''; if (!$html) { die("\n+++++ Get Video List Is Empty! ++++\n"); } preg_match_all('#<a title="[^"]+" href="(/read/\\d+\\.html)" class="pic"><img src="([^"]+)" alt="([^"]+)" class="imgpic"/></a>#Uis', $html, $match); $titlePool = $match[3]; $urlPool = $match[1]; $coverPool = $match[2]; preg_match_all('#<span>主演:([^<]+) </span>#Uis', $html, $match); $actorPool = $match[1]; $return = array(); foreach ($titlePool as $k => $title) { $title = trim($title); $cover = getFullPath($coverPool[$k]); $cover = preg_replace('#\\?.+#is', '', $cover); $cover = preg_replace('#\\#.+#is', '', $cover); $actor = trim($actorPool[$k]); $actor = str_replace(' ', ',', $actor); $actor = str_replace(' ', ',', $actor); $actor = str_replace(' ', ',', $actor); $actor = str_replace('、', ',', $actor); $return[] = array('name' => $title, 'ourl' => $urlPool[$k], 'actor' => $actor, 'cover' => $cover); } return $return; var_dump($return); exit; }
function getParseListInfo($html) { preg_match('#<ul class="list_show grid_mode c_clear" id="contents">(.+)</ul>#Uis', $html, $match); $html = isset($match[1]) ? $match[1] : ''; if (!$html) { die("\n+++++ Get Video List Is Empty! ++++\n"); } preg_match_all('#<li><a class="play_pic" target="_blank" href="([^"]+)"><img src="([^"]+)" alt="[^"]+" onerror="[^"]+" title="([^"]+)" />#Uis', $html, $match); $titlePool = $match[3]; $urlPool = $match[1]; $coverPool = $match[2]; preg_match_all('#<p class="actor"><em>主演:</em>([^<]*)</p>#Uis', $html, $match); $actorPool = $match[1]; $return = array(); foreach ($titlePool as $k => $title) { $title = trim($title); $cover = getFullPath($coverPool[$k]); $cover = preg_replace('#\\?.+#is', '', $cover); $cover = preg_replace('#\\#.+#is', '', $cover); $actor = str_replace(' ', ',', $actorPool[$k]); $actor = str_replace(' ', ',', $actor); $actor = str_replace(' ', ',', $actor); $actor = str_replace('、', ',', $actor); $return[] = array('name' => $title, 'ourl' => $urlPool[$k], 'actor' => $actor, 'cover' => $cover); } return $return; var_dump($match); exit; }
function telegram_sendphoto($chat_id, $caption, $photo) { if (is_int($caption) && get_post_type($caption) == 'telegram_commands') { $reply_markup = json_encode(telegram_get_reply_markup($caption)); $caption = get_post_field('post_content', $caption); } else { $reply_markup = json_encode(telegram_get_reply_markup(0)); } $caption = telegram_parsetext($caption, 'photo', $chat_id); $url = 'https://api.telegram.org/bot' . telegram_option('token') . '/sendPhoto'; $photo = getFullPath($photo); $data = compact('chat_id', 'caption', 'photo', 'reply_markup'); $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($finfo, $data['photo']); $data['photo'] = new CurlFile($data['photo'], $mime_type, $data['photo']); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = json_decode(curl_exec($ch), true); telegram_log('<<<< PHO', $chat_id, $caption); telegram_increase_dispatch(); return; }