code push

This commit is contained in:
2025-08-07 15:24:29 -07:00
parent b5e091d845
commit 3b499e2074
15 changed files with 1225 additions and 232 deletions

View File

@@ -28,6 +28,45 @@ function twp_activate() {
TWP_Activator::activate();
}
/**
* Check if Twilio SDK is installed and show admin notice if not
*/
function twp_check_sdk_installation() {
$autoloader_path = TWP_PLUGIN_DIR . 'vendor/autoload.php';
$sdk_installed = false;
if (file_exists($autoloader_path)) {
// Try to load autoloader and check for classes
require_once $autoloader_path;
$sdk_installed = class_exists('Twilio\Rest\Client');
}
if (!$sdk_installed) {
add_action('admin_notices', 'twp_sdk_missing_notice');
}
}
/**
* Display admin notice for missing SDK
*/
function twp_sdk_missing_notice() {
?>
<div class="notice notice-error is-dismissible">
<h3>Twilio WordPress Plugin - SDK Required</h3>
<p><strong>The Twilio PHP SDK is required for this plugin to work.</strong></p>
<p>To install the SDK, run this command in your plugin directory:</p>
<code>chmod +x install-twilio-sdk.sh && ./install-twilio-sdk.sh</code>
<p>Or install via Composer: <code>composer install</code></p>
<p><em>Plugin path: <?php echo TWP_PLUGIN_DIR; ?></em></p>
</div>
<?php
}
// Check SDK installation on admin pages
if (is_admin()) {
add_action('admin_init', 'twp_check_sdk_installation');
}
/**
* Plugin deactivation hook
*/