Notebook

<?php
/*
Plugin Name: HistoryNote Core – Social Wall
Description: Konum tabanlı, KYC destekli, Takvim ve Duvar hibrit sosyal medya çekirdeği.
Version: 1.0
Author: Codecia
*/

// 1. GÜVENLİK VE GİRİŞ KONTROLLERİ
if (!defined(‘ABSPATH’)) exit;

// 2. ÖZEL VERİ TİPLERİ (POST TYPES) – Notlar ve Duvarlar için
function hn_register_post_types() {
    // “History Note” – Tarihe Not Düş
    register_post_type(‘history_note’, array(
        ‘labels’ => array(‘name’ => ‘History Notes’, ‘singular_name’ => ‘Note’),
        ‘public’ => true,
        ‘has_archive’ => true,
        ‘supports’ => array(‘title’, ‘editor’, ‘author’, ‘custom-fields’),
        ‘show_in_rest’ => true, // Mobil uygulamalar (API) için gerekli
    ));
}
add_action(‘init’, ‘hn_register_post_types’);

// 3. DUVAR KATEGORİLERİ (TAXONOMIES)
function hn_register_taxonomies() {
    register_taxonomy(‘wall_type’, ‘history_note’, array(
        ‘labels’ => array(‘name’ => ‘Wall Types’),
        ‘public’ => true,
        ‘hierarchical’ => true,
        ‘show_in_rest’ => true,
    ));
   
    // Varsayılan Duvarları Oluştur
    if (!term_exists(‘Public Wall’, ‘wall_type’)) wp_insert_term(‘Public Wall’, ‘wall_type’);
    if (!term_exists(‘University Wall’, ‘wall_type’)) wp_insert_term(‘University Wall’, ‘wall_type’);
    if (!term_exists(‘News Wall’, ‘wall_type’)) wp_insert_term(‘News Wall’, ‘wall_type’);
    if (!term_exists(‘Art Wall’, ‘wall_type’)) wp_insert_term(‘Art Wall’, ‘wall_type’);
}
add_action(‘init’, ‘hn_register_taxonomies’);

// 4. RADİKAL GİRİŞ EKRANI VE NOT FORMU (SHORTCODE)
// Kullanımı: Bir sayfaya [history_input] yazın.
function hn_input_form_shortcode() {
    if (!is_user_logged_in()) {
        return ‘<div class=”hn-login-gate”>Lütfen önce <a href=”‘.wp_login_url().'”>Giriş Yapın</a> veya KYC ile Doğrulayın.</div>’;
    }

    if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’ && isset($_POST[‘hn_submit_note’])) {
        // Notu Kaydet
        $post_id = wp_insert_post(array(
            ‘post_title’   => sanitize_text_field($_POST[‘hn_title’]),
            ‘post_content’ => sanitize_textarea_field($_POST[‘hn_content’]),
            ‘post_status’  => ‘publish’,
            ‘post_type’    => ‘history_note’,
            ‘post_author’  => get_current_user_id(),
        ));

        // Duvar Seçimi ve Meta Veriler
        if ($post_id) {
            wp_set_object_terms($post_id, intval($_POST[‘hn_wall’]), ‘wall_type’);
            update_post_meta($post_id, ‘hn_location’, sanitize_text_field($_POST[‘hn_location’])); // Konum
            update_post_meta($post_id, ‘hn_is_official’, ‘pending’); // KYC Doğrulama durumu
            echo ‘<div class=”hn-success”>Tarihe not düşüldü!</div>’;
        }
    }

    // HTML FORM (Radikal Basit Arayüz)
    ob_start();
    ?>
    <style>
        .hn-container { max-width: 600px; margin: 0 auto; background: #000; color: #fff; padding: 20px; font-family: ‘Courier New’, monospace; min-height: 100vh; }
        .hn-input { width: 100%; background: transparent; border: none; border-bottom: 2px solid #333; color: #fff; font-size: 1.5rem; padding: 10px; margin-bottom: 20px; outline: none; }
        .hn-textarea { width: 100%; background: #111; border: none; color: #0f0; height: 150px; padding: 10px; font-family: monospace; }
        .hn-select { background: #222; color: #fff; border: 1px solid #444; padding: 10px; width: 100%; margin-bottom: 20px; }
        .hn-btn { background: #fff; color: #000; border: none; padding: 15px 30px; font-weight: bold; cursor: pointer; width: 100%; text-transform: uppercase; letter-spacing: 2px; }
        .hn-date-display { font-size: 0.8rem; color: #666; text-align: right; margin-bottom: 30px; }
    </style>
   
    <div class=”hn-container”>
        <div class=”hn-date-display”><?php echo date(‘Y.m.d | H:i’); ?> // NOTE TO HISTORY</div>
       
        <form method=”post”>
            <input type=”text” name=”hn_title” class=”hn-input” placeholder=”Başlık / Konu…” required>
           
            <select name=”hn_wall” class=”hn-select”>
                <option value=””>Duvar Seçiniz (Where to post?)</option>
                <?php
                $terms = get_terms(array(‘taxonomy’ => ‘wall_type’, ‘hide_empty’ => false));
                foreach ($terms as $term) {
                    echo ‘<option value=”‘.$term->term_id.'”>Request to: ‘.$term->name.'</option>’;
                }
                ?>
            </select>
           
            <textarea name=”hn_content” class=”hn-textarea” placeholder=”Tarihe ne not düşmek istersin? (Write a note to history)”></textarea>
           
            <input type=”hidden” name=”hn_location” id=”hn_location_input” value=”Unknown”>
           
            <br><br>
            <button type=”submit” name=”hn_submit_note” class=”hn-btn”>NOTE IT</button>
        </form>
    </div>
   
    <script>
        // Basit Geolocation Alımı
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
                document.getElementById(‘hn_location_input’).value = position.coords.latitude + ‘,’ + position.coords.longitude;
            });
        }
    </script>
    <?php
    return ob_get_clean();
}
add_shortcode(‘history_input’, ‘hn_input_form_shortcode’);

// 5. DUVAR AKIŞI (WALL DISPLAY – Google Takvim Gibi Listeleme)
// Kullanımı: [history_wall type=”public”]
function hn_wall_display_shortcode($atts) {
    $atts = shortcode_atts(array(‘type’ => ‘public-wall’), $atts);
   
    $args = array(
        ‘post_type’ => ‘history_note’,
        ‘tax_query’ => array(
            array(
                ‘taxonomy’ => ‘wall_type’,
                ‘field’ => ‘slug’,
                ‘terms’ => $atts[‘type’],
            ),
        ),
        ‘posts_per_page’ => 20,
    );
   
    $query = new WP_Query($args);
   
    ob_start();
    echo ‘<div class=”hn-wall-feed” style=”background:#f4f4f4; padding:20px;”>’;
    echo ‘<h3>Wall: ‘.strtoupper($atts[‘type’]).'</h3>’;
   
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $is_official = get_post_meta(get_the_ID(), ‘hn_is_official’, true) == ‘verified’;
            $official_badge = $is_official ? ‘<span style=”color:blue”>✓ Official</span>’ : ”;
           
            echo ‘<div style=”background:#fff; margin-bottom:15px; padding:15px; border-left: 5px solid #000;”>’;
            echo ‘<small>’.get_the_date(‘d M Y H:i’).’ | ‘.get_post_meta(get_the_ID(), ‘hn_location’, true).'</small>’;
            echo ‘<h4>’.get_the_title().’ ‘.$official_badge.'</h4>’;
            echo ‘<div>’.get_the_excerpt().'</div>’;
            echo ‘</div>’;
        }
    } else {
        echo ‘Bu duvarda henüz not yok.’;
    }
    echo ‘</div>’;
    wp_reset_postdata();
    return ob_get_clean();
}
add_shortcode(‘history_wall’, ‘hn_wall_display_shortcode’);

@media (max-width: 768px) { .hn-container, .hn-wall-feed { max-width: 100%; padding: 10px; } .hn-input, .hn-textarea { font-size: 1.2rem; } } /* Paylaşım Butonları Stili */ .hn-share-container { margin-top: 20px; text-align: center; } .hn-share-container button { margin: 5px; padding: 10px 20px; background: #28a745; color: #fff; border: none; cursor: pointer; } /* Grok AI Entegrasyonu (Link) */ .hn-grok-ai { margin-top: 20px; text-align: center; } .hn-grok-ai a { color: #0f0; text-decoration: none; font-weight: bold; } HistoryNote Core – Social Wall (Grok Edition) body { font-family: ‘Courier New’, monospace; background: #000; color: #fff; margin: 0; padding: 0; } .hn-container { max-width: 600px; margin: 0 auto; background: #000; padding: 20px; min-height: 50vh; } .hn-input { width: 100%; background: transparent; border: none; border-bottom: 2px solid #333; color: #fff; font-size: 1.5rem; padding: 10px; margin-bottom: 20px; outline: none; } .hn-textarea { width: 100%; background: #111; border: none; color: #0f0; height: 150px; padding: 10px; font-family: monospace; resize: vertical; } .hn-select { background: #222; color: #fff; border: 1px solid #444; padding: 10px; width: 100%; margin-bottom: 20px; } .hn-btn { background: #fff; color: #000; border: none; padding: 15px 30px; font-weight: bold; cursor: pointer; width: 100%; text-transform: uppercase; letter-spacing: 2px; } .hn-date-display { font-size: 0.8rem; color: #666; text-align: right; margin-bottom: 30px; } .hn-wall-feed { max-width: 600px; margin: 20px auto; background: #f4f4f4; color: #000; padding: 20px; } .hn-note-item { background: #fff; margin-bottom: 15px; padding: 15px; border-left: 5px solid #000; } .hn-official-badge { color: blue; font-weight: bold; } .hn-share-btn { background: #007bff; color: #fff; border: none; padding: 5px 10px; cursor: pointer; margin-top: 10px; } .hn-calendar-view { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 20px; } .hn-calendar-day { background: #222; padding: 10px; text-align: center; cursor: pointer; } .hn-calendar-day.active { background: #0f0; color: #000; } /* Grok Ekstra Özellikler: Responsive Tasarım (Mobile/PC) */ @media (max-width: 768px) { .hn-container, .hn-wall-feed { max-width: 100%; padding: 10px; } .hn-input, .hn-textarea { font-size: 1.2rem; } } /* Paylaşım Butonları Stili */ .hn-share-container { margin-top: 20px; text-align: center; } .hn-share-container button { margin: 5px; padding: 10px 20px; background: #28a745; color: #fff; border: none; cursor: pointer; } /* Grok AI Entegrasyonu (Link) */ .hn-grok-ai { margin-top: 20px; text-align: center; } .hn-grok-ai a { color: #0f0; text-decoration: none; font-weight: bold; }
Duvar Seçiniz (Where to post?) Request to: Public Wall Request to: University Wall Request to: News Wall Request to: Art Wall Not Tarihi (Daily Note):

Wall: PUBLIC-WALL (Örnek Notlar – Yerel Depolama ile Dinamik)

// Tarih Gösterimi document.getElementById(‘current-date’).textContent = new Date().toLocaleString() + ‘ // NOTE TO HISTORY’; // Geolocation Alımı if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { document.getElementById(‘hn_location’).value = position.coords.latitude + ‘,’ + position.coords.longitude; }); } // Yerel Depolama için Notlar (Grok Ekstra: Backend Olmadan Çalışsın) let notes = JSON.parse(localStorage.getItem(‘hn_notes’)) || []; // Not Ekleme ve Gösterme document.getElementById(‘hn-note-form’).addEventListener(‘submit’, function(e) { e.preventDefault(); const title = document.getElementById(‘hn_title’).value; const content = document.getElementById(‘hn_content’).value; const wall = document.getElementById(‘hn_wall’).value || ‘Public Wall’; const location = document.getElementById(‘hn_location’).value; const date = document.getElementById(‘hn_date’).value || new Date().toISOString().split(‘T’)[0]; const isOfficial = Math.random() > 0.5 ? ‘verified’ : ‘pending’; // Simüle KYC const newNote = { title, content, wall, location, date, isOfficial }; notes.push(newNote); localStorage.setItem(‘hn_notes’, JSON.stringify(notes)); displayNotes(); displayCalendar(); alert(‘Tarihe not düşüldü! (Yerel depolama ile kaydedildi)’); e.target.reset(); }); // Notları Göster function displayNotes(wallType = ‘Public Wall’) { const feed = document.getElementById(‘hn-wall-feed’); feed.innerHTML = `

Wall: ${wallType.toUpperCase()}

`; notes.filter(note => note.wall === wallType).forEach(note => { const officialBadge = note.isOfficial === ‘verified’ ? ‘✓ Official‘ : ”; feed.innerHTML += `
${note.date} | ${note.location}

${note.title} ${officialBadge}

${note.content.substring(0, 100)}…
`; }); if (notes.length === 0) feed.innerHTML += ‘

Bu duvarda henüz not yok.

‘; } // Takvim Görünümü Oluştur (Grok Ekstra: Google Takvim Gibi) function displayCalendar() { const calendar = document.getElementById(‘hn-calendar-view’); calendar.innerHTML = ”; const daysInMonth = new Date().getDate(); // Basit aylık takvim for (let i = 1; i new Date(note.date).getDate() === i); if (dayNotes.length > 0) day.classList.add(‘active’); day.addEventListener(‘click’, () => alert(`Günün Notları: ${dayNotes.map(n => n.title).join(‘, ‘)}`)); calendar.appendChild(day); } } // Paylaşım Fonksiyonları (Grok Ekstra) function shareOnSocial(platform) { const url = window.location.href; const text = ‘HistoryNote Social Wall\’dan bir not paylaşıyorum!’; if (platform === ‘Twitter’) window.open(`https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(url)}`); if (platform === ‘Facebook’) window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`); } function copyLink() { navigator.clipboard.writeText(window.location.href).then(() => alert(‘Link kopyalandı!’)); } function shareNote(title, content) { const text = `Not: ${title} – ${content.substring(0, 50)}…`; alert(`Paylaşılıyor: ${text} (Gerçek paylaşım için sosyal API entegrasyonu ekleyin)`); } // Başlangıçta Yükle displayNotes(); displayCalendar();

ki

Unknown's avatar

Author: pixelencia

MEHMETADANİR81@GMAİL.COM / 05524026685/DİYARBAKIR/YENİŞEHİR/TURKEY/TC/TR/TRY/TL