function tb_send($page, $links) { global $trackback, $page_title; if (!$trackback) { return; } // No link, END if (!is_array($links) || empty($links)) { return; } $script = get_script_uri(); // PROHIBITION OF INVALID TRANSMISSION $url = parse_url($script); $host = empty($url['host']) ? $script : $url['host']; if (is_ipaddr($host)) { if (is_localIP($host)) { return; } } else { if (is_ReservedTLD($host)) { return; } } if (is_ignore_page($page)) { return; } // Disable 'max execution time' (php.ini: max_execution_time) if (ini_get('safe_mode') == '0') { set_time_limit(0); } $r_page = rawurlencode($page); $excerpt = strip_htmltag(convert_html(get_source($page))); // Sender's information $putdata = array('title' => $page, 'url' => $script . '?' . $r_page, 'excerpt' => mb_strimwidth(preg_replace("/[\r\n]/", ' ', $excerpt), 0, 255, '...'), 'blog_name' => $page_title . ' (' . PLUGIN_TRACKBACK_VERSION . ')', 'charset' => SOURCE_ENCODING); foreach ($links as $link) { if (path_check($script, $link)) { continue; } // Same Site $tb_id = tb_get_url($link); // Get Trackback ID from the URL if (empty($tb_id)) { continue; } // Trackback is not supported $result = http_request($tb_id, 'POST', '', $putdata, 2, CONTENT_CHARSET); // FIXME: Create warning notification space at pukiwiki.skin! } }
function tb_send($page, $plus, $minus = '') { global $page_title; $script = get_script_uri(); // Disable 'max execution time' (php.ini: max_execution_time) if (ini_get('safe_mode') == '0') { set_time_limit(0); } // Get URLs from <a>(anchor) tag from convert_html() $links = array(); $plus = convert_html($plus); // WARNING: heavy and may cause side-effect preg_match_all('#href="(https?://[^"]+)"#', $plus, $links, PREG_PATTERN_ORDER); $links = array_unique($links[1]); // Reject from minus list if ($minus != '') { $links_m = array(); $minus = convert_html($minus); // WARNING: heavy and may cause side-effect preg_match_all('#href="(https?://[^"]+)"#', $minus, $links_m, PREG_PATTERN_ORDER); $links_m = array_unique($links_m[1]); $links = array_diff($links, $links_m); } // Reject own URL (Pattern _NOT_ started with '$script' and '?') $links = preg_grep('/^(?!' . preg_quote($script, '/') . '\\?)./', $links); // No link, END if (!is_array($links) || empty($links)) { return; } $r_page = rawurlencode($page); $excerpt = strip_htmltag(convert_html(get_source($page))); // Sender's information $putdata = array('title' => $page, 'url' => $script . '?' . $r_page, 'excerpt' => mb_strimwidth(preg_replace("/[\r\n]/", ' ', $excerpt), 0, 255, '...'), 'blog_name' => $page_title . ' (' . PLUGIN_TRACKBACK_VERSION . ')', 'charset' => SOURCE_ENCODING); foreach ($links as $link) { $tb_id = tb_get_url($link); // Get Trackback ID from the URL if (empty($tb_id)) { continue; } // Trackback is not supported $result = http_request($tb_id, 'POST', '', $putdata, 2, CONTENT_CHARSET); // FIXME: Create warning notification space at pukiwiki.skin! } }