php Plugin Name Serial Player Light Description Лёгкий плеер сериалов без тяжёлых зависимостей. Version 1.0 --- Мета-бокс и сохранение (оставляем как было, это не тормозит фронтенд) --- if ( ! function_exists( 'serial_player_add_meta_box' ) ) { function serial_player_add_meta_box() { add_meta_box('serial_player_box', 'Ссылки на серии (каждая с новой строки)', 'serial_player_box_html', 'post', 'normal', 'high'); } add_action('add_meta_boxes', 'serial_player_add_meta_box'); } if ( ! function_exists( 'serial_player_box_html' ) ) { function serial_player_box_html($post) { $video_links = get_post_meta($post-ID, '_serial_video_links', true); echo 'plabel for=serial_video_linksФормат Ссылка (Перевод) или 1-2 Ссылка или off (Текст ошибки). Для разделения сезонов напишите слово Сезон на отдельной строкеlabelp'; echo 'textarea id=serial_video_links name=serial_video_links style=width100%; height140px;' . esc_textarea($video_links) . 'textarea'; } } if ( ! function_exists( 'serial_player_save_meta_box' ) ) { function serial_player_save_meta_box($post_id) { if (array_key_exists('serial_video_links', $_POST)) { update_post_meta($post_id, '_serial_video_links', sanitize_textarea_field($_POST['serial_video_links'])); } } add_action('save_post', 'serial_player_save_meta_box'); } --- Подключаем стили и скрипты (выносим из шорткода) --- function serial_player_assets() { $dir_url = plugin_dir_url(__FILE__); wp_enqueue_style('serial-player-style', $dir_url . 'cssserial-player.css', [], '1.0'); wp_enqueue_script('serial-player-script', $dir_url . 'jsserial-player.js', [], '1.0', true); } add_action('wp_enqueue_scripts', 'serial_player_assets'); --- Шорткод (только HTML, без CSS и без JS) --- if ( ! function_exists( 'serial_player_shortcode' ) ) { function serial_player_shortcode() { global $post; if ( ! is_single() is_feed() is_search() is_archive() ) { return ''; } $raw_links = get_post_meta($post-ID, '_serial_video_links', true); if (empty($raw_links)) { return 'pВидео для этого сериала еще не добавлены.p'; } $raw_links = str_replace(r, , $raw_links); $lines = array_filter(array_map('trim', explode(n, $raw_links))); if (empty($lines)) { return ''; } Первая рабочая ссылка $first_link = ''; foreach ($lines as $line) { $clean_line = trim($line); $lower_line = mb_strtolower($clean_line, 'UTF-8'); if (mb_strpos($lower_line, 'сезон') !== false mb_strpos($lower_line, 'season') !== false) { continue; } if (strpos($clean_line, '') !== false) { $parts = explode('', $clean_line, 2); $clean_line = isset($parts[1]) trim($parts[1]) $clean_line; } if (strpos($clean_line, '---------') !== false) { continue; } if (strpos($clean_line, '(') !== false) { $open_p = strpos($clean_line, '('); $clean_line = trim(substr($clean_line, 0, $open_p)); } if (strpos($clean_line, 'off') !== 0 && strpos($clean_line, 'anon') !== 0 && strpos($clean_line, 'soon') !== 0) { $first_link = $clean_line; break; } } if (empty($first_link)) { $first_link = 'aboutblank'; } $output = 'div class=serial-player-container' . 'div class=serial-video-wrapper' . 'iframe src=' . esc_url($first_link) . ' name=serial_frame id=videoScreen frameborder=0 allowfullscreen allow=autoplay; encrypted-mediaiframe' . 'div class=video-placeholder style=displaynone;' . 'div class=placeholder-contentdiv' . 'div' . 'div' . 'div class=serial-playlist' . 'div class=serial-playlist-headerh3Выбор серииh3div'; $all_buttons = ''; $current_episode_count = 0; $auto_index = 1; foreach ($lines as $line) { $line = trim($line); if (empty($line)) continue; $lower_line = mb_strtolower($line, 'UTF-8'); if (mb_strpos($lower_line, 'сезон') !== false mb_strpos($lower_line, 'season') !== false strpos($line, '---------') !== false) { if ($current_episode_count 0) { $output .= 'div class=serial-season-group'; $output .= 'div class=serial-episodes-list' . $all_buttons . 'div'; $output .= 'div'; $all_buttons = ''; $current_episode_count = 0; $auto_index = 1; } $output .= 'div class=serial-season-divider' . esc_html($line) . 'div'; continue; } $link = $line; $note = ''; $custom_number = ''; if (strpos($line, '') !== false) { $parts_array = explode('', $line, 2); $custom_number = isset($parts_array[0]) trim($parts_array[0]) ''; $link = isset($parts_array[1]) trim($parts_array[1]) $line; } if (strpos($link, '(') !== false && strpos($link, ')') !== false) { $open_pos = strpos($link, '('); $close_pos = strpos($link, ')'); if ($close_pos $open_pos) { $note = trim(substr($link, $open_pos + 1, $close_pos - $open_pos - 1)); $link = trim(substr($link, 0, $open_pos)); } } $status_class = ''; $data_msg = ''; if (strpos($link, 'off') === 0 strpos($link, 'anon') === 0 strpos($link, 'soon') === 0) { if (strpos($link, 'off') === 0) { $status_class = ' status-off'; $data_msg = 'Серия временно недоступна'; } else { $status_class = ' status-anon'; $data_msg = 'Анонс серии'; } $link = '#'; } if (!empty($custom_number)) { $display_number = $custom_number; if (strpos($custom_number, '-') !== false) { $range_parts = explode('-', $custom_number); $end_num = intval(end($range_parts)); if ($end_num 0) { $auto_index = $end_num + 1; } } else { if (intval($custom_number) 0) { $auto_index = intval($custom_number) + 1; } } } else { $display_number = $auto_index; $auto_index++; } $display_name = 'Серия ' . $display_number; if (!empty($note)) { $display_name .= ' (' . $note . ')'; } $msg_attr = $data_msg ' data-msg=' . esc_attr($data_msg) . '' ''; $all_buttons .= 'a href=' . esc_attr($link) . ' target=serial_frame class=episode-btn' . $status_class . '' . $msg_attr . '' . $display_name . 'a'; $current_episode_count++; } if ($current_episode_count 0) { $output .= 'div class=serial-season-group'; $output .= 'div class=serial-episodes-list' . $all_buttons . 'div'; $output .= 'div'; } $output .= 'divdiv'; return $output; } add_shortcode('serial_player', 'serial_player_shortcode'); } Access Denied

403 Forbidden

Access denied by Bot Traffic Shield. AI crawlers and unauthorized automated scrapers are prohibited from indexing this website.