/**
* Plugin Name: WP Yahoo RSS (With SEO Delay & Security Hardening)
* Plugin URI: https://gen.caca01.com/
* Description: Wordpress Yahoo RSS feed tweaked for only tyenews.com (Includes SEO Time Delay, Path locking, and Performance fix)
* Version: 1.0.9
* Author: Carter Wu (Final Patch: Route locking + Query Scoping + UTC Time) + Safe Cache Patch
* Author URI: https://gen.caca01.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: wp-yahoo-rss
*/
if (!defined('ABSPATH')) exit;
const YH_DELAY_MINUTES = 120;
const YH_QUERY_VAR = 'yh_feed_stats';
function yh_register_rewrite_rules() {
add_rewrite_rule('^yahoo-rss(?:/([^/]+))?/?$', 'index.php?' . YH_QUERY_VAR . '=true&type=$matches[1]', 'top');
}
add_filter('query_vars', 'yh_feed_query_vars');
function yh_feed_query_vars($query_vars) {
$query_vars[] = YH_QUERY_VAR;
$query_vars[] = 'type';
return $query_vars;
}
register_activation_hook(__FILE__, 'yh_feed_activate');
function yh_feed_activate() {
yh_register_rewrite_rules();
flush_rewrite_rules(false);
}
register_deactivation_hook(__FILE__, 'yh_feed_deactivate');
function yh_feed_deactivate() {
flush_rewrite_rules(false);
}
add_action('init', 'yh_feed_init');
function yh_feed_init() {
yh_register_rewrite_rules();
}
add_action('parse_request', 'yh_feed_parse_request');
function yh_feed_parse_request(&$wp) {
if (!array_key_exists(YH_QUERY_VAR, $wp->query_vars)) {
return;
}
$is_yahoo_path = false;
if (!empty($wp->request) && preg_match('#^yahoo-rss(?:/|$)#', $wp->request)) {
$is_yahoo_path = true;
}
if ($is_yahoo_path) {
if (!defined('IS_YAHOO_FEED')) {
define('IS_YAHOO_FEED', true);
}
$linkify_path = dirname(__FILE__) . '/data/linkify.php';
if (file_exists($linkify_path)) {
require_once $linkify_path;
}
}
}
add_action('template_redirect', 'yh_feed_render_output');
function yh_feed_render_output() {
if (!defined('IS_YAHOO_FEED') || IS_YAHOO_FEED !== true) {
return;
}
if (!defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE', true);
if (!defined('DONOTCACHEOBJECT')) define('DONOTCACHEOBJECT', true);
if (!defined('DONOTCACHEDB')) define('DONOTCACHEDB', true);
// ✅ 改這裡:用 query var 取 type(rewrite 進來就是 query var)
$type = get_query_var('type');
$type = is_string($type) ? sanitize_key($type) : '';
$cache_key = 'yh_yahoo_feed_xml_' . md5($type);
$force = (isset($_GET['nocache']) && $_GET['nocache'] !== '');
if (!$force) {
$cached = get_transient($cache_key);
if (is_string($cached) && $cached !== '') {
header('Content-Type: text/xml; charset=utf-8');
echo $cached;
exit();
}
}
$list_path = dirname(__FILE__) . '/data/list.php';
if (!file_exists($list_path)) {
status_header(404);
header('Content-Type: text/plain; charset=UTF-8');
echo 'Error: RSS template file not found.';
exit();
}
ob_start();
try {
include $list_path;
$xml = ob_get_clean();
} catch (Throwable $e) {
if (ob_get_level()) ob_end_clean();
status_header(500);
header('Content-Type: text/plain; charset=UTF-8');
echo 'Feed error: ' . $e->getMessage();
exit();
}
if (is_string($xml) && $xml !== '') {
set_transient($cache_key, $xml, 60);
}
header('Content-Type: text/xml; charset=utf-8');
echo $xml;
exit();
}
function yh_filter_cats($categories) {
if (empty($categories) || !is_array($categories)) return '';
foreach ($categories as $category) {
if (!is_object($category)) continue;
$name = isset($category->name) ? trim((string)$category->name) : '';
$slug = isset($category->slug) ? strtolower(trim((string)$category->slug)) : '';
if (
$name === 'YAHOO' ||
$name === '不送YAHOO' ||
$slug === 'nosend-yahoo' ||
$slug === '不上yahoo' ||
strpos($slug, 'yahoo') !== false
) {
return '';
}
}
return isset($categories[0]->name) ? esc_html($categories[0]->name) : '';
}
function yh_cat_yahoo($category) {
return $category;
}
add_action('pre_get_posts', 'yh_exclude_nosend_yahoo_from_yahoo_rss');
function yh_exclude_nosend_yahoo_from_yahoo_rss($query) {
if (is_admin() || !defined('IS_YAHOO_FEED') || IS_YAHOO_FEED !== true) {
return;
}
$pt = $query->get('post_type');
if (!empty($pt) && $pt !== 'post') {
return;
}
$query->set('post_type', 'post');
static $exclude_term_ids = null;
if ($exclude_term_ids === null) {
$exclude_term_ids = array();
$term_slugs = array('nosend-yahoo', '不上yahoo');
foreach ($term_slugs as $slug) {
$term = get_category_by_slug($slug);
if ($term && !is_wp_error($term)) {
$exclude_term_ids[] = (int) $term->term_id;
}
}
}
if (!empty($exclude_term_ids)) {
$tax_query = (array) $query->get('tax_query');
$tax_query[] = array(
'taxonomy' => 'category',
'field' => 'term_id',
'terms' => $exclude_term_ids,
'operator' => 'NOT IN',
);
$query->set('tax_query', $tax_query);
}
$delay_minutes = (int) YH_DELAY_MINUTES;
if ($delay_minutes > 0) {
$cutoff_ts = (int) current_time('timestamp', true) - ($delay_minutes * 60);
$cutoff_time = gmdate('Y-m-d H:i:s', $cutoff_ts);
$date_query = (array) $query->get('date_query');
$date_query[] = array(
'column' => 'post_date_gmt',
'before' => $cutoff_time,
);
$query->set('date_query', $date_query);
}
$query->set('ignore_sticky_posts', true);
$query->set('no_found_rows', true);
$query->set('cache_results', false);
$query->set('update_post_meta_cache', false);
$query->set('update_post_term_cache', true);
}
中央大學認定論文抄襲 鄭寶清回應了
- 網紅「四叉貓」去(2022)年9月稱前立委鄭寶清買網軍,遭鄭寶清提告後,四叉貓再爆鄭寶清的中央大學博士論文涉嫌抄襲,並向校方檢舉此事。
- 昨(12)日中央大學審定委員會公布審查結果,確定鄭寶清論文有抄襲,只是「非屬情節重大」,故要求鄭寶清重新修畢學術倫理相關課程,並在論文第一頁。
- 對此,鄭寶清回應,因當時並無比對系統,致造成部分引註疏漏,關於這個部分,他表示歉意。
- Q:這篇在講什麼?
- A:網紅「四叉貓」去(2022)年9月稱前立委鄭寶清買網軍,遭鄭寶清提告後,四叉貓再爆鄭寶清的中央大學博士論文涉嫌抄襲,並向校方檢舉此事。
- Q:重點是什麼?
- A:昨(12)日中央大學審定委員會公布審查結果,確定鄭寶清論文有抄襲,只是「非屬情節重大」,故要求鄭寶清重新修畢學術倫理相關課程,並在論文第一頁。
網紅「四叉貓」去(2022)年9月稱前立委鄭寶清買網軍,遭鄭寶清提告後,四叉貓再爆鄭寶清的中央大學博士論文涉嫌抄襲,並向校方檢舉此事。昨(12)日中央大學審定委員會公布審查結果,確定鄭寶清論文有抄襲,只是「非屬情節重大」,故要求鄭寶清重新修畢學術倫理相關課程,並在論文第一頁公開道歉、說明論文修正重點,限期3個月內完成。對此,鄭寶清回應,因當時並無比對系統,致造成部分引註疏漏,關於這個部分,他表示歉意。
中央大學認定鄭寶清論文抄襲。示意圖:翻攝自鄭寶清臉書
據悉,去年四叉貓比對出鄭寶清的論文有35%涉嫌抄襲。其實,鄭寶清10年前就被檢舉過,不過當時校方審查結果是沒有抄襲,如今中央大學再接獲四叉貓的檢舉,重新審查後結果逆轉,確認鄭寶清論文有抄襲。
對此,鄭寶清說明,論文最重要的精髓是研究架構、研究方法、研究發現、創新貢獻及結論;而台鹽改革和研究發現皆為他在台鹽公司親力親為之心得,是全球唯一,無法抄襲,此創新研究更讓台鹽點鹽成金,轉虧為盈,該論文亦獲歐洲國家圖書館翻譯成各國語言典藏,也獲國內各研究單位及碩博士參考引用。因當時並無比對系統,致造成部分引註疏漏,自己的論文有10萬多字,約4000多字引註疏漏,佔論文整體約5%。
鄭寶清還引用去年教育部長潘文忠接受國民黨籍立委鄭正鈐質詢時的內容。當時鄭正鈐說,學界一般認為25%至30%的相似度,是勉強可被接受的。潘文忠則回覆,數據只是參考,因為論文還有審查制度。此外,鄭寶清還舉出清華大學副校長戴念華接受媒體採訪時的內容,戴念華曾說,論文被送到國外期刊發表時,會要求進行比對,相似度過高,就會被退件,國際期刊的標準是相似度不超過20%左右。因此,這次鄭寶清稱自己的論文相似度約5%,應是中央大學此次認定「非屬情節重大」的原因。