Plugin Directory

Changeset 3490347


Ignore:
Timestamp:
03/24/2026 08:21:40 PM (8 days ago)
Author:
mervinpraison
Message:

Update to version 1.3.0 from GitHub

Location:
praison-file-content-git
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • praison-file-content-git/tags/1.3.0/praisonpressgit.php

    r3490022 r3490347  
    33 * Plugin Name: PraisonAI Git Posts
    44 * Description: Load WordPress content from files (Markdown, JSON, YAML) without database writes, with Git-based version control
    5  * Version: 1.2.0
     5 * Version: 1.3.0
    66 * Author: MervinPraison
    77 * Author URI: https://mer.vin
     
    1313
    1414// Define constants
    15 define('PRAISON_VERSION', '1.1.0');
     15define('PRAISON_VERSION', '1.3.0');
    1616define('PRAISON_PLUGIN_DIR', __DIR__);
    1717define('PRAISON_PLUGIN_URL', trailingslashit(plugins_url('', __FILE__)));
  • praison-file-content-git/tags/1.3.0/scripts/export-to-markdown.php

    r3426687 r3490347  
    127127    $custom_fields = [];
    128128   
     129    // Load exclude list from ExportConfig if available
     130    $exclude_meta = [];
     131    if (class_exists('PraisonPress\\Export\\ExportConfig')) {
     132        $exportConfig = new PraisonPress\Export\ExportConfig();
     133        $exclude_meta = $exportConfig->getExcludeMeta($post->post_type);
     134    }
     135   
     136    // Allow filtering via WordPress hook (generic for all users)
     137    $exclude_meta = apply_filters('praison_export_exclude_meta', $exclude_meta, $post->post_type, $post->ID);
     138   
    129139    // Check if ACF is active
    130140    $has_acf = function_exists('get_fields');
     
    135145        if ($acf_fields) {
    136146            foreach ($acf_fields as $key => $value) {
    137                 $custom_fields[$key] = $value;
     147                if (!in_array($key, $exclude_meta, true)) {
     148                    $custom_fields[$key] = $value;
     149                }
    138150            }
    139151        }
     
    143155    $all_meta = get_post_meta($post->ID);
    144156    foreach ($all_meta as $key => $value) {
    145         // Skip WordPress internal fields and ACF internal fields
    146         if (strpos($key, '_') !== 0 && !isset($custom_fields[$key])) {
     157        // Skip WordPress internal fields, ACF internal fields, and excluded fields
     158        if (strpos($key, '_') !== 0 && !isset($custom_fields[$key]) && !in_array($key, $exclude_meta, true)) {
    147159            $custom_fields[$key] = is_array($value) && count($value) === 1 ? $value[0] : $value;
    148160        }
  • praison-file-content-git/tags/1.3.0/src/Core/Bootstrap.php

    r3490022 r3490347  
    318318        // If no file-based posts, return database posts as-is
    319319        if (empty($file_posts)) {
    320             if (function_exists('do_action')) {
     320            if (get_option('praisonpress_qm_logging')) {
    321321                do_action('qm/debug', sprintf(
    322322                    '[PraisonPress] DB fallback for "%s" (post_type=%s)',
     
    331331        // This happens when WordPress hasn't queried the database yet
    332332        if ($posts === null) {
    333             if (function_exists('do_action')) {
     333            if (get_option('praisonpress_qm_logging')) {
    334334                do_action('qm/info', sprintf(
    335335                    '[PraisonPress] ✅ HEADLESS: Serving %d post(s) from Git files (post_type=%s, slug=%s)',
     
    344344        // MERGE: Combine database posts with file-based posts
    345345        // File-based posts take precedence for duplicate slugs
    346         if (function_exists('do_action')) {
     346        if (get_option('praisonpress_qm_logging')) {
    347347            do_action('qm/info', sprintf(
    348348                '[PraisonPress] ✅ HEADLESS+MERGE: %d file post(s) + %d DB post(s) (post_type=%s)',
     
    588588     */
    589589    public function renderSettingsPage() {
     590        // Handle settings save
     591        if (isset($_POST['praisonpress_save_settings']) && check_admin_referer('praisonpress_settings_nonce')) {
     592            $qm_logging = isset($_POST['praisonpress_qm_logging']) ? 1 : 0;
     593            update_option('praisonpress_qm_logging', $qm_logging);
     594            echo '<div class="notice notice-success"><p>✅ Settings saved.</p></div>';
     595        }
     596       
     597        $qm_enabled = get_option('praisonpress_qm_logging', 0);
    590598        ?>
    591599        <div class="wrap">
     
    593601           
    594602            <div class="card" style="max-width: 800px;">
     603                <h2>🔍 Diagnostics</h2>
     604                <form method="post">
     605                    <?php wp_nonce_field('praisonpress_settings_nonce'); ?>
     606                    <table class="form-table">
     607                        <tr>
     608                            <th scope="row">Query Monitor Logging</th>
     609                            <td>
     610                                <label>
     611                                    <input type="checkbox" name="praisonpress_qm_logging" value="1" <?php checked($qm_enabled, 1); ?> />
     612                                    Enable headless content source logging in Query Monitor
     613                                </label>
     614                                <p class="description">When enabled, each page load logs whether content was served from Git files or the database. Visible in Query Monitor's "Logs" panel. No performance impact when disabled.</p>
     615                            </td>
     616                        </tr>
     617                    </table>
     618                    <p class="submit">
     619                        <input type="submit" name="praisonpress_save_settings" class="button button-primary" value="Save Settings" />
     620                    </p>
     621                </form>
     622            </div>
     623           
     624            <div class="card" style="max-width: 800px; margin-top: 20px;">
    595625                <h2>⚙️ Configuration</h2>
    596626                <p>Edit your configuration file at:</p>
  • praison-file-content-git/tags/1.3.0/src/Export/ExportConfig.php

    r3426687 r3490347  
    175175   
    176176    /**
     177     * Get meta fields to exclude from export.
     178     * Merges global [exclude_meta] keys with per-post-type exclude_meta.
     179     *
     180     * @param string $postType Post type name
     181     * @return array Array of meta field names to exclude
     182     */
     183    public function getExcludeMeta($postType) {
     184        // Global excludes from [exclude_meta] section
     185        $globalExcludes = [];
     186        if (isset($this->config['exclude_meta'])) {
     187            $globalExcludes = array_keys(array_filter($this->config['exclude_meta']));
     188        }
     189       
     190        // Per-post-type excludes
     191        $config = $this->getPostTypeConfig($postType);
     192        $typeExcludes = [];
     193        if (isset($config['exclude_meta'])) {
     194            if (is_string($config['exclude_meta'])) {
     195                $typeExcludes = array_map('trim', explode(',', $config['exclude_meta']));
     196            } elseif (is_array($config['exclude_meta'])) {
     197                $typeExcludes = $config['exclude_meta'];
     198            }
     199        }
     200       
     201        return array_unique(array_merge($globalExcludes, $typeExcludes));
     202    }
     203   
     204    /**
    177205     * Generate file path for a post based on configuration
    178206     *
  • praison-file-content-git/trunk/praisonpressgit.php

    r3490022 r3490347  
    33 * Plugin Name: PraisonAI Git Posts
    44 * Description: Load WordPress content from files (Markdown, JSON, YAML) without database writes, with Git-based version control
    5  * Version: 1.2.0
     5 * Version: 1.3.0
    66 * Author: MervinPraison
    77 * Author URI: https://mer.vin
     
    1313
    1414// Define constants
    15 define('PRAISON_VERSION', '1.1.0');
     15define('PRAISON_VERSION', '1.3.0');
    1616define('PRAISON_PLUGIN_DIR', __DIR__);
    1717define('PRAISON_PLUGIN_URL', trailingslashit(plugins_url('', __FILE__)));
  • praison-file-content-git/trunk/scripts/export-to-markdown.php

    r3426687 r3490347  
    127127    $custom_fields = [];
    128128   
     129    // Load exclude list from ExportConfig if available
     130    $exclude_meta = [];
     131    if (class_exists('PraisonPress\\Export\\ExportConfig')) {
     132        $exportConfig = new PraisonPress\Export\ExportConfig();
     133        $exclude_meta = $exportConfig->getExcludeMeta($post->post_type);
     134    }
     135   
     136    // Allow filtering via WordPress hook (generic for all users)
     137    $exclude_meta = apply_filters('praison_export_exclude_meta', $exclude_meta, $post->post_type, $post->ID);
     138   
    129139    // Check if ACF is active
    130140    $has_acf = function_exists('get_fields');
     
    135145        if ($acf_fields) {
    136146            foreach ($acf_fields as $key => $value) {
    137                 $custom_fields[$key] = $value;
     147                if (!in_array($key, $exclude_meta, true)) {
     148                    $custom_fields[$key] = $value;
     149                }
    138150            }
    139151        }
     
    143155    $all_meta = get_post_meta($post->ID);
    144156    foreach ($all_meta as $key => $value) {
    145         // Skip WordPress internal fields and ACF internal fields
    146         if (strpos($key, '_') !== 0 && !isset($custom_fields[$key])) {
     157        // Skip WordPress internal fields, ACF internal fields, and excluded fields
     158        if (strpos($key, '_') !== 0 && !isset($custom_fields[$key]) && !in_array($key, $exclude_meta, true)) {
    147159            $custom_fields[$key] = is_array($value) && count($value) === 1 ? $value[0] : $value;
    148160        }
  • praison-file-content-git/trunk/src/Core/Bootstrap.php

    r3490022 r3490347  
    318318        // If no file-based posts, return database posts as-is
    319319        if (empty($file_posts)) {
    320             if (function_exists('do_action')) {
     320            if (get_option('praisonpress_qm_logging')) {
    321321                do_action('qm/debug', sprintf(
    322322                    '[PraisonPress] DB fallback for "%s" (post_type=%s)',
     
    331331        // This happens when WordPress hasn't queried the database yet
    332332        if ($posts === null) {
    333             if (function_exists('do_action')) {
     333            if (get_option('praisonpress_qm_logging')) {
    334334                do_action('qm/info', sprintf(
    335335                    '[PraisonPress] ✅ HEADLESS: Serving %d post(s) from Git files (post_type=%s, slug=%s)',
     
    344344        // MERGE: Combine database posts with file-based posts
    345345        // File-based posts take precedence for duplicate slugs
    346         if (function_exists('do_action')) {
     346        if (get_option('praisonpress_qm_logging')) {
    347347            do_action('qm/info', sprintf(
    348348                '[PraisonPress] ✅ HEADLESS+MERGE: %d file post(s) + %d DB post(s) (post_type=%s)',
     
    588588     */
    589589    public function renderSettingsPage() {
     590        // Handle settings save
     591        if (isset($_POST['praisonpress_save_settings']) && check_admin_referer('praisonpress_settings_nonce')) {
     592            $qm_logging = isset($_POST['praisonpress_qm_logging']) ? 1 : 0;
     593            update_option('praisonpress_qm_logging', $qm_logging);
     594            echo '<div class="notice notice-success"><p>✅ Settings saved.</p></div>';
     595        }
     596       
     597        $qm_enabled = get_option('praisonpress_qm_logging', 0);
    590598        ?>
    591599        <div class="wrap">
     
    593601           
    594602            <div class="card" style="max-width: 800px;">
     603                <h2>🔍 Diagnostics</h2>
     604                <form method="post">
     605                    <?php wp_nonce_field('praisonpress_settings_nonce'); ?>
     606                    <table class="form-table">
     607                        <tr>
     608                            <th scope="row">Query Monitor Logging</th>
     609                            <td>
     610                                <label>
     611                                    <input type="checkbox" name="praisonpress_qm_logging" value="1" <?php checked($qm_enabled, 1); ?> />
     612                                    Enable headless content source logging in Query Monitor
     613                                </label>
     614                                <p class="description">When enabled, each page load logs whether content was served from Git files or the database. Visible in Query Monitor's "Logs" panel. No performance impact when disabled.</p>
     615                            </td>
     616                        </tr>
     617                    </table>
     618                    <p class="submit">
     619                        <input type="submit" name="praisonpress_save_settings" class="button button-primary" value="Save Settings" />
     620                    </p>
     621                </form>
     622            </div>
     623           
     624            <div class="card" style="max-width: 800px; margin-top: 20px;">
    595625                <h2>⚙️ Configuration</h2>
    596626                <p>Edit your configuration file at:</p>
  • praison-file-content-git/trunk/src/Export/ExportConfig.php

    r3426687 r3490347  
    175175   
    176176    /**
     177     * Get meta fields to exclude from export.
     178     * Merges global [exclude_meta] keys with per-post-type exclude_meta.
     179     *
     180     * @param string $postType Post type name
     181     * @return array Array of meta field names to exclude
     182     */
     183    public function getExcludeMeta($postType) {
     184        // Global excludes from [exclude_meta] section
     185        $globalExcludes = [];
     186        if (isset($this->config['exclude_meta'])) {
     187            $globalExcludes = array_keys(array_filter($this->config['exclude_meta']));
     188        }
     189       
     190        // Per-post-type excludes
     191        $config = $this->getPostTypeConfig($postType);
     192        $typeExcludes = [];
     193        if (isset($config['exclude_meta'])) {
     194            if (is_string($config['exclude_meta'])) {
     195                $typeExcludes = array_map('trim', explode(',', $config['exclude_meta']));
     196            } elseif (is_array($config['exclude_meta'])) {
     197                $typeExcludes = $config['exclude_meta'];
     198            }
     199        }
     200       
     201        return array_unique(array_merge($globalExcludes, $typeExcludes));
     202    }
     203   
     204    /**
    177205     * Generate file path for a post based on configuration
    178206     *
Note: See TracChangeset for help on using the changeset viewer.