��<?php /* Plugin Name: Tenderslink Display Description: Displays tenders from Tenderfile.csv with search and pagination. Version: 1.0 Author: Custom */ function tenderslink_display_shortcode() { $csv_file = WP_CONTENT_DIR . '/Tenderfile.csv'; ob_start(); ?> <div class="tenderslink-search-wrapper"> <form class="tenderslink-search-form" role="search" method="get"> <input type="search" class="tenderslink-search-input" placeholder="Search tenders..." value="" /> <button type="submit" class="tenderslink-search-button">Search</button> </form> </div> <div class="tenderslink-tender-list" id="tenderslink-tender-list"> <?php if (file_exists($csv_file) && ($handle = fopen($csv_file, 'r')) !== false) { $header = fgetcsv($handle); $count = 0; while (($data = fgetcsv($handle)) !== false && $count < 10000) { // Changed from 500 to 10000 $tln = esc_attr($data[0]); $authority = esc_html($data[1]); $title = esc_html($data[2] === '#NAME?' ? $data[6] : $data[2]); $tender_id = esc_html($data[3]); $tender_value = esc_html($data[4]); $due_date = esc_html($data[5]); $work_brief = esc_html($data[6]); $status_link = 'https://tenderslink.com/subscribe-0/'; ?> <div class="tenderslink-tender-container" data-tln="<?php echo $tln; ?>"> <div class="tenderslink-tender-header"> <h3><?php echo $authority; ?></h3> <a class="tenderslink-tender-button" href="<?php echo $status_link; ?>">View Status</a> </div> <hr class="tenderslink-tender-divider"/> <p class="tenderslink-tender-title"><strong>Title:</strong> <?php echo $title; ?></p> <div class="tenderslink-tender-details"> <span><strong>TLN:</strong> <?php echo $tln; ?></span> <span><strong>Tender ID:</strong> <span class="tenderslink-blurred"><?php echo $tender_id; ?></span></span> <span><strong>Due Date:</strong> <?php echo $due_date; ?></span> </div> <p class="tenderslink-tender-value"><strong>Tender Value:</strong> <span class="tenderslink-blurred"><?php echo $tender_value; ?></span></p> <p class="tenderslink-tender-brief admin-only"><strong>Work Brief:</strong> <?php echo $work_brief; ?></p> </div> <?php $count++; } fclose($handle); } else { echo '<p>Error: Unable to load tenders. Please check Tenderfile.csv.</p>'; } ?> <div class="tenderslink-pagination"> <button id="tenderslink-prev-page" disabled>Previous</button> <span id="tenderslink-page-info">Page 1 of 1000</span> <!-- Updated to reflect potential max pages --> <button id="tenderslink-next-page">Next</button> </div> </div> <?php return ob_get_clean(); } add_shortcode('tenderslink_list', 'tenderslink_display_shortcode'); function tenderslink_enqueue_assets() { if (has_shortcode(get_post()->post_content, 'tenderslink_list')) { wp_enqueue_style('tenderslink-styles', plugin_dir_url(__FILE__) . 'tenderslink-styles.css', [], '1.0'); wp_enqueue_script('tenderslink-script', plugin_dir_url(__FILE__) . 'tenderslink-script.js', [], '1.0', true); } } add_action('wp_enqueue_scripts', 'tenderslink_enqueue_assets'); function tenderslink_body_class($classes) { if (current_user_can('manage_options')) { $classes[] = 'admin-logged-in'; } return $classes; } add_filter('body_class', 'tenderslink_body_class'); function tenderslink_admin_menu() { add_menu_page('Tenderslink Generator', 'Tenderslink', 'manage_options', 'tenderslink-generator', 'tenderslink_generate_html_page'); } add_action('admin_menu', 'tenderslink_admin_menu'); function tenderslink_generate_html_page() { if (!current_user_can('manage_options')) { wp_die('Unauthorized.'); } $csv_file = WP_CONTENT_DIR . '/Tenderfile.csv'; $output_file = WP_CONTENT_DIR . '/tenders.html'; if (isset($_POST['generate_tenders']) && file_exists($csv_file)) { $html = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Tender List</title>'; $html .= '<link rel="stylesheet" href="' . plugin_dir_url(__FILE__) . 'tenderslink-styles.css">'; $html .= '</head><body>'; $html .= '<div class="tenderslink-search-wrapper"><form class="tenderslink-search-form" role="search" method="get"><input type="search" class="tenderslink-search-input" placeholder="Search tenders..." value="" /><button type="submit" class="tenderslink-search-button">Search</button></form></div>'; $html .= '<div class="tenderslink-tender-list" id="tenderslink-tender-list">'; if (($handle = fopen($csv_file, 'r')) !== false) { $header = fgetcsv($handle); $count = 0; while (($data = fgetcsv($handle)) !== false && $count < 10000) { // Changed from 500 to 10000 $tln = htmlspecialchars($data[0]); $authority = htmlspecialchars($data[1]); $title = htmlspecialchars($data[2] === '#NAME?' ? $data[6] : $data[2]); $tender_id = htmlspecialchars($data[3]); $tender_value = htmlspecialchars($data[4]); $due_date = htmlspecialchars($data[5]); $work_brief = htmlspecialchars($data[6]); $status_link = 'https://tenderslink.com/subscribe-0/'; $html .= "<div class=\"tenderslink-tender-container\" data-tln=\"{$tln}\"><div class=\"tenderslink-tender-header\"><h3>{$authority}</h3><a class=\"tenderslink-tender-button\" href=\"{$status_link}\">View Status</a></div><hr class=\"tenderslink-tender-divider\"/><p class=\"tenderslink-tender-title\"><strong>Title:</strong> {$title}</p><div class=\"tenderslink-tender-details\"><span><strong>TLN:</strong> {$tln}</span><span><strong>Tender ID:</strong> <span class=\"tenderslink-blurred\">{$tender_id}</ >B25BAB25=: <span><strong>Due Date:</strong> {$due_date}</span></div><p class=\"tenderslink-tender-value\"><strong>Tender Value:</strong> <span class=\"tenderslink-blurred\">{$tender_value}</span></p><p class=\"tenderslink-tender-brief admin-only\"><strong>Work Brief:</strong> {$work_brief}</p></div>"; $count++; } fclose($handle); } $html .= '<div class="tenderslink-pagination"><button id="tenderslink-prev-page" disabled>Previous</button><span id="tenderslink-page-info">Page 1 of 1000</span><button id="tenderslink-next-page">Next</button></div></div>'; $html .= '<script src="' . plugin_dir_url(__FILE__) . 'tenderslink-script.js"></script>'; $html .= '</body></html>'; if (file_put_contents($output_file, $html)) { echo '<div class="notice notice-success"><p>tenders.html generated at: ' . $output_file . '</p></div>'; } else { echo '<div class="notice notice-error"><p>Failed to generate tenders.html.</p></div>'; } } ?> <div class="wrap"> <h1>Tenderslink HTML Generator</h1> <form method="post"> <p><input type="submit" name="generate_tenders" class="button button-primary" value="Generate tenders.html"></p> </form> </div> <?php } ?>
Warning: Cannot modify header information - headers already sent by (output started at /home/kqvlwfgc/public_html/wp-content/plugins/Tenderdisplay/tenderslink-display.php:1) in /home/kqvlwfgc/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1896

Warning: Cannot modify header information - headers already sent by (output started at /home/kqvlwfgc/public_html/wp-content/plugins/Tenderdisplay/tenderslink-display.php:1) in /home/kqvlwfgc/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1896

Warning: Cannot modify header information - headers already sent by (output started at /home/kqvlwfgc/public_html/wp-content/plugins/Tenderdisplay/tenderslink-display.php:1) in /home/kqvlwfgc/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1896

Warning: Cannot modify header information - headers already sent by (output started at /home/kqvlwfgc/public_html/wp-content/plugins/Tenderdisplay/tenderslink-display.php:1) in /home/kqvlwfgc/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1896

Warning: Cannot modify header information - headers already sent by (output started at /home/kqvlwfgc/public_html/wp-content/plugins/Tenderdisplay/tenderslink-display.php:1) in /home/kqvlwfgc/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1896

Warning: Cannot modify header information - headers already sent by (output started at /home/kqvlwfgc/public_html/wp-content/plugins/Tenderdisplay/tenderslink-display.php:1) in /home/kqvlwfgc/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1896

Warning: Cannot modify header information - headers already sent by (output started at /home/kqvlwfgc/public_html/wp-content/plugins/Tenderdisplay/tenderslink-display.php:1) in /home/kqvlwfgc/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1896

Warning: Cannot modify header information - headers already sent by (output started at /home/kqvlwfgc/public_html/wp-content/plugins/Tenderdisplay/tenderslink-display.php:1) in /home/kqvlwfgc/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1896
{"id":3071,"date":"2025-06-04T07:44:39","date_gmt":"2025-06-04T07:44:39","guid":{"rendered":"https:\/\/tenderslink.com\/?page_id=3071"},"modified":"2025-06-04T07:44:39","modified_gmt":"2025-06-04T07:44:39","slug":"tenders-2","status":"publish","type":"page","link":"https:\/\/tenderslink.com\/?page_id=3071","title":{"rendered":"Tenders"},"content":{"rendered":"

[tenderslink_list]<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-3071","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"\nTenders - Tender Link<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tenderslink.com\/?page_id=3071\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tenders - Tender Link\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tenderslink.com\/?page_id=3071\" \/>\n<meta property=\"og:site_name\" content=\"Tender Link\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tenderslink.com\/?page_id=3071\",\"url\":\"https:\/\/tenderslink.com\/?page_id=3071\",\"name\":\"Tenders - Tender Link\",\"isPartOf\":{\"@id\":\"https:\/\/tenderslink.com\/#website\"},\"datePublished\":\"2025-06-04T07:44:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/tenderslink.com\/?page_id=3071#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tenderslink.com\/?page_id=3071\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tenderslink.com\/?page_id=3071#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tenderslink.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tenders\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tenderslink.com\/#website\",\"url\":\"https:\/\/tenderslink.com\/\",\"name\":\"Tender Link\",\"description\":\"Professional Services Since 2015\",\"publisher\":{\"@id\":\"https:\/\/tenderslink.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tenderslink.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/tenderslink.com\/#organization\",\"name\":\"Tender Link\",\"url\":\"https:\/\/tenderslink.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tenderslink.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/tenderslink.com\/wp-content\/uploads\/2025\/06\/output-1.png\",\"contentUrl\":\"https:\/\/tenderslink.com\/wp-content\/uploads\/2025\/06\/output-1.png\",\"width\":1024,\"height\":1024,\"caption\":\"Tender Link\"},\"image\":{\"@id\":\"https:\/\/tenderslink.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tenders - Tender Link","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/tenderslink.com\/?page_id=3071","og_locale":"en_US","og_type":"article","og_title":"Tenders - Tender Link","og_url":"https:\/\/tenderslink.com\/?page_id=3071","og_site_name":"Tender Link","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tenderslink.com\/?page_id=3071","url":"https:\/\/tenderslink.com\/?page_id=3071","name":"Tenders - Tender Link","isPartOf":{"@id":"https:\/\/tenderslink.com\/#website"},"datePublished":"2025-06-04T07:44:39+00:00","breadcrumb":{"@id":"https:\/\/tenderslink.com\/?page_id=3071#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tenderslink.com\/?page_id=3071"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/tenderslink.com\/?page_id=3071#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tenderslink.com\/"},{"@type":"ListItem","position":2,"name":"Tenders"}]},{"@type":"WebSite","@id":"https:\/\/tenderslink.com\/#website","url":"https:\/\/tenderslink.com\/","name":"Tender Link","description":"Professional Services Since 2015","publisher":{"@id":"https:\/\/tenderslink.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tenderslink.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/tenderslink.com\/#organization","name":"Tender Link","url":"https:\/\/tenderslink.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tenderslink.com\/#\/schema\/logo\/image\/","url":"https:\/\/tenderslink.com\/wp-content\/uploads\/2025\/06\/output-1.png","contentUrl":"https:\/\/tenderslink.com\/wp-content\/uploads\/2025\/06\/output-1.png","width":1024,"height":1024,"caption":"Tender Link"},"image":{"@id":"https:\/\/tenderslink.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/tenderslink.com\/index.php?rest_route=\/wp\/v2\/pages\/3071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tenderslink.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tenderslink.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tenderslink.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tenderslink.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3071"}],"version-history":[{"count":0,"href":"https:\/\/tenderslink.com\/index.php?rest_route=\/wp\/v2\/pages\/3071\/revisions"}],"wp:attachment":[{"href":"https:\/\/tenderslink.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}