Plugin Directory

Changeset 3462159


Ignore:
Timestamp:
02/16/2026 02:39:47 AM (6 weeks ago)
Author:
visiblefirst
Message:

Release 3.2.62 - Monthly citation report email with score changes and recommendations

Location:
visiblefirst
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • visiblefirst/tags/3.2.62/includes/modules/citations/class-visibl-citations.php

    r3462157 r3462159  
    674674        }
    675675
     676        // Get previous results for comparison
     677        $previous_results = get_option('visibl_citation_results', []);
     678        $previous_score = $previous_results['score'] ?? 0;
     679
    676680        // Run scan
    677681        $business_info = get_option('visibl_business_info', []);
     
    682686                $results['score'] = self::calculate_score($results);
    683687                update_option('visibl_citation_results', $results);
     688
     689                // Send progress email
     690                self::send_monthly_report_email($results, $previous_score, $business_info);
    684691            }
    685692        }
     
    697704        wp_schedule_event($monitoring['next_billing'], 'monthly', 'visibl_monthly_monitoring_cron');
    698705    }
     706
     707    /**
     708     * Send monthly citation report email
     709     */
     710    private static function send_monthly_report_email($results, $previous_score, $business_info) {
     711        $admin_email = get_option('admin_email');
     712        $site_name = get_bloginfo('name');
     713        $company_name = $business_info['company_name'] ?? $site_name;
     714        $current_score = $results['score'] ?? 0;
     715        $score_change = $current_score - $previous_score;
     716
     717        // Count found vs missing
     718        $found_count = 0;
     719        $missing_count = 0;
     720        $missing_directories = [];
     721
     722        foreach ($results['directories'] ?? [] as $key => $dir) {
     723            if (!empty($dir['found'])) {
     724                $found_count++;
     725            } else {
     726                $missing_count++;
     727                $missing_directories[$key] = self::$directories[$key] ?? [];
     728            }
     729        }
     730
     731        // Build email subject
     732        if ($score_change > 0) {
     733            $subject = sprintf(
     734                /* translators: %1$s: company name, %2$d: score change */
     735                __('VisibleFirst: %1$s Citation Score Improved by %2$d%%', 'visiblefirst'),
     736                $company_name,
     737                $score_change
     738            );
     739        } elseif ($score_change < 0) {
     740            $subject = sprintf(
     741                /* translators: %1$s: company name, %2$d: score change */
     742                __('VisibleFirst: %1$s Citation Score Dropped by %2$d%%', 'visiblefirst'),
     743                $company_name,
     744                abs($score_change)
     745            );
     746        } else {
     747            $subject = sprintf(
     748                /* translators: %s: company name */
     749                __('VisibleFirst: %s Monthly Citation Report', 'visiblefirst'),
     750                $company_name
     751            );
     752        }
     753
     754        // Build email body
     755        $body = sprintf(
     756            /* translators: %s: company name */
     757            __("Monthly Citation Report for %s\n", 'visiblefirst'),
     758            $company_name
     759        );
     760        $body .= "========================================\n\n";
     761
     762        // Score summary
     763        $body .= sprintf(
     764            /* translators: %d: current score */
     765            __("Current Score: %d%%\n", 'visiblefirst'),
     766            $current_score
     767        );
     768
     769        if ($score_change !== 0) {
     770            $body .= sprintf(
     771                /* translators: %s: change indicator with number */
     772                __("Change: %s\n", 'visiblefirst'),
     773                ($score_change > 0 ? '+' : '') . $score_change . '%'
     774            );
     775        }
     776
     777        $body .= sprintf(
     778            /* translators: %1$d: found count, %2$d: total count */
     779            __("Listings Found: %1$d of %2$d directories\n\n", 'visiblefirst'),
     780            $found_count,
     781            $found_count + $missing_count
     782        );
     783
     784        // Missing directories with recommendations
     785        if (!empty($missing_directories)) {
     786            $body .= __("Recommended Next Steps\n", 'visiblefirst');
     787            $body .= "----------------------------------------\n";
     788
     789            // Prioritize by tier
     790            $priority_order = ['critical', 'high', 'medium', 'low'];
     791            $sorted = [];
     792            foreach ($priority_order as $tier) {
     793                foreach ($missing_directories as $key => $dir) {
     794                    if (($dir['tier'] ?? '') === $tier) {
     795                        $sorted[$key] = $dir;
     796                    }
     797                }
     798            }
     799
     800            $count = 0;
     801            foreach ($sorted as $key => $dir) {
     802                if ($count >= 5) {
     803                    break; // Top 5 recommendations
     804                }
     805                $body .= sprintf(
     806                    "\n%d. %s (%s priority)\n",
     807                    $count + 1,
     808                    $dir['name'] ?? $key,
     809                    ucfirst($dir['tier'] ?? 'medium')
     810                );
     811                if (!empty($dir['url'])) {
     812                    $body .= sprintf("   Submit here: %s\n", $dir['url']);
     813                }
     814                $count++;
     815            }
     816
     817            if (count($missing_directories) > 5) {
     818                $body .= sprintf(
     819                    /* translators: %d: remaining count */
     820                    __("\n...and %d more directories to claim.\n", 'visiblefirst'),
     821                    count($missing_directories) - 5
     822                );
     823            }
     824        } else {
     825            $body .= __("Congratulations! You're listed in all monitored directories.\n", 'visiblefirst');
     826        }
     827
     828        // Footer
     829        $body .= "\n----------------------------------------\n";
     830        $body .= sprintf(
     831            /* translators: %s: admin URL */
     832            __("View full report: %s\n", 'visiblefirst'),
     833            admin_url('admin.php?page=visibl-settings&tab=citations')
     834        );
     835        $body .= __("\nThis scan was performed automatically as part of your monthly monitoring subscription.\n", 'visiblefirst');
     836
     837        // Send email
     838        wp_mail($admin_email, $subject, $body);
     839    }
    699840}
    700841
  • visiblefirst/tags/3.2.62/readme.txt

    r3462157 r3462159  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 3.2.61
     7Stable tag: 3.2.62
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    196196
    197197== Changelog ==
     198
     199= 3.2.62 =
     200* NEW: Monthly citation report email with score changes and recommendations
     201* NEW: Prioritized next steps based on directory importance (critical/high/medium/low)
    198202
    199203= 3.2.61 =
  • visiblefirst/tags/3.2.62/visiblefirst.php

    r3462157 r3462159  
    33 * Plugin Name: VisibleFirst
    44 * Description: AI + SEO + Social visibility in one plugin. Complete visibility optimization for WordPress.
    5  * Version: 3.2.61
     5 * Version: 3.2.62
    66 * Author: VisibleFirst
    77 * Author URI: https://visiblefirst.com
     
    1616
    1717// Plugin constants
    18 define('VISIBL_VERSION', '3.2.61');
     18define('VISIBL_VERSION', '3.2.62');
    1919define('VISIBL_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2020define('VISIBL_PLUGIN_URL', plugin_dir_url(__FILE__));
  • visiblefirst/trunk/includes/modules/citations/class-visibl-citations.php

    r3462157 r3462159  
    674674        }
    675675
     676        // Get previous results for comparison
     677        $previous_results = get_option('visibl_citation_results', []);
     678        $previous_score = $previous_results['score'] ?? 0;
     679
    676680        // Run scan
    677681        $business_info = get_option('visibl_business_info', []);
     
    682686                $results['score'] = self::calculate_score($results);
    683687                update_option('visibl_citation_results', $results);
     688
     689                // Send progress email
     690                self::send_monthly_report_email($results, $previous_score, $business_info);
    684691            }
    685692        }
     
    697704        wp_schedule_event($monitoring['next_billing'], 'monthly', 'visibl_monthly_monitoring_cron');
    698705    }
     706
     707    /**
     708     * Send monthly citation report email
     709     */
     710    private static function send_monthly_report_email($results, $previous_score, $business_info) {
     711        $admin_email = get_option('admin_email');
     712        $site_name = get_bloginfo('name');
     713        $company_name = $business_info['company_name'] ?? $site_name;
     714        $current_score = $results['score'] ?? 0;
     715        $score_change = $current_score - $previous_score;
     716
     717        // Count found vs missing
     718        $found_count = 0;
     719        $missing_count = 0;
     720        $missing_directories = [];
     721
     722        foreach ($results['directories'] ?? [] as $key => $dir) {
     723            if (!empty($dir['found'])) {
     724                $found_count++;
     725            } else {
     726                $missing_count++;
     727                $missing_directories[$key] = self::$directories[$key] ?? [];
     728            }
     729        }
     730
     731        // Build email subject
     732        if ($score_change > 0) {
     733            $subject = sprintf(
     734                /* translators: %1$s: company name, %2$d: score change */
     735                __('VisibleFirst: %1$s Citation Score Improved by %2$d%%', 'visiblefirst'),
     736                $company_name,
     737                $score_change
     738            );
     739        } elseif ($score_change < 0) {
     740            $subject = sprintf(
     741                /* translators: %1$s: company name, %2$d: score change */
     742                __('VisibleFirst: %1$s Citation Score Dropped by %2$d%%', 'visiblefirst'),
     743                $company_name,
     744                abs($score_change)
     745            );
     746        } else {
     747            $subject = sprintf(
     748                /* translators: %s: company name */
     749                __('VisibleFirst: %s Monthly Citation Report', 'visiblefirst'),
     750                $company_name
     751            );
     752        }
     753
     754        // Build email body
     755        $body = sprintf(
     756            /* translators: %s: company name */
     757            __("Monthly Citation Report for %s\n", 'visiblefirst'),
     758            $company_name
     759        );
     760        $body .= "========================================\n\n";
     761
     762        // Score summary
     763        $body .= sprintf(
     764            /* translators: %d: current score */
     765            __("Current Score: %d%%\n", 'visiblefirst'),
     766            $current_score
     767        );
     768
     769        if ($score_change !== 0) {
     770            $body .= sprintf(
     771                /* translators: %s: change indicator with number */
     772                __("Change: %s\n", 'visiblefirst'),
     773                ($score_change > 0 ? '+' : '') . $score_change . '%'
     774            );
     775        }
     776
     777        $body .= sprintf(
     778            /* translators: %1$d: found count, %2$d: total count */
     779            __("Listings Found: %1$d of %2$d directories\n\n", 'visiblefirst'),
     780            $found_count,
     781            $found_count + $missing_count
     782        );
     783
     784        // Missing directories with recommendations
     785        if (!empty($missing_directories)) {
     786            $body .= __("Recommended Next Steps\n", 'visiblefirst');
     787            $body .= "----------------------------------------\n";
     788
     789            // Prioritize by tier
     790            $priority_order = ['critical', 'high', 'medium', 'low'];
     791            $sorted = [];
     792            foreach ($priority_order as $tier) {
     793                foreach ($missing_directories as $key => $dir) {
     794                    if (($dir['tier'] ?? '') === $tier) {
     795                        $sorted[$key] = $dir;
     796                    }
     797                }
     798            }
     799
     800            $count = 0;
     801            foreach ($sorted as $key => $dir) {
     802                if ($count >= 5) {
     803                    break; // Top 5 recommendations
     804                }
     805                $body .= sprintf(
     806                    "\n%d. %s (%s priority)\n",
     807                    $count + 1,
     808                    $dir['name'] ?? $key,
     809                    ucfirst($dir['tier'] ?? 'medium')
     810                );
     811                if (!empty($dir['url'])) {
     812                    $body .= sprintf("   Submit here: %s\n", $dir['url']);
     813                }
     814                $count++;
     815            }
     816
     817            if (count($missing_directories) > 5) {
     818                $body .= sprintf(
     819                    /* translators: %d: remaining count */
     820                    __("\n...and %d more directories to claim.\n", 'visiblefirst'),
     821                    count($missing_directories) - 5
     822                );
     823            }
     824        } else {
     825            $body .= __("Congratulations! You're listed in all monitored directories.\n", 'visiblefirst');
     826        }
     827
     828        // Footer
     829        $body .= "\n----------------------------------------\n";
     830        $body .= sprintf(
     831            /* translators: %s: admin URL */
     832            __("View full report: %s\n", 'visiblefirst'),
     833            admin_url('admin.php?page=visibl-settings&tab=citations')
     834        );
     835        $body .= __("\nThis scan was performed automatically as part of your monthly monitoring subscription.\n", 'visiblefirst');
     836
     837        // Send email
     838        wp_mail($admin_email, $subject, $body);
     839    }
    699840}
    700841
  • visiblefirst/trunk/readme.txt

    r3462157 r3462159  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 3.2.61
     7Stable tag: 3.2.62
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    196196
    197197== Changelog ==
     198
     199= 3.2.62 =
     200* NEW: Monthly citation report email with score changes and recommendations
     201* NEW: Prioritized next steps based on directory importance (critical/high/medium/low)
    198202
    199203= 3.2.61 =
  • visiblefirst/trunk/visiblefirst.php

    r3462157 r3462159  
    33 * Plugin Name: VisibleFirst
    44 * Description: AI + SEO + Social visibility in one plugin. Complete visibility optimization for WordPress.
    5  * Version: 3.2.61
     5 * Version: 3.2.62
    66 * Author: VisibleFirst
    77 * Author URI: https://visiblefirst.com
     
    1616
    1717// Plugin constants
    18 define('VISIBL_VERSION', '3.2.61');
     18define('VISIBL_VERSION', '3.2.62');
    1919define('VISIBL_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2020define('VISIBL_PLUGIN_URL', plugin_dir_url(__FILE__));
Note: See TracChangeset for help on using the changeset viewer.