Changeset 3348046
- Timestamp:
- 08/21/2025 10:38:46 AM (6 months ago)
- Location:
- techvoot-app-firebase/trunk
- Files:
-
- 4 edited
-
classes/class-tv-push-notification.php (modified) (4 diffs)
-
classes/settings/class-tv-settings-configuration.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
-
techvoot-app-firebase.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
techvoot-app-firebase/trunk/classes/class-tv-push-notification.php
r3259015 r3348046 44 44 private function getAccessToken() 45 45 { 46 $key_file = TV_PLUGIN_PATH . '/techvoot-5d6e1-firebase-adminsdk-fbsvc-fc62bad6e9.json'; 46 // Get the Firebase JSON key file path from the database 47 $key_file = get_option('tv_firebase_json_key', ''); 48 49 if (empty($key_file) || !file_exists($key_file)) { 50 wp_die(__('Firebase JSON key file is missing or not set. Please upload your JSON credentials.', 'techvoot-app-firebase')); 51 } 52 53 // Read credentials from the file 47 54 $credentials = json_decode(file_get_contents($key_file), true); 55 56 if (!$credentials) { 57 wp_die(__('Invalid Firebase JSON key file.', 'techvoot-app-firebase')); 58 } 48 59 49 60 $token_uri = 'https://oauth2.googleapis.com/token'; … … 54 65 55 66 $assertion = [ 56 'iss' => $credentials['client_email'],67 'iss' => $credentials['client_email'], 57 68 'scope' => 'https://www.googleapis.com/auth/cloud-platform', 58 'aud' => $token_uri,59 'iat' => $now,60 'exp' => $exp69 'aud' => $token_uri, 70 'iat' => $now, 71 'exp' => $exp 61 72 ]; 62 73 … … 66 77 $postdata = [ 67 78 'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer', 68 'assertion' => $jwt79 'assertion' => $jwt 69 80 ]; 70 81 … … 79 90 80 91 $response = json_decode($result, true); 92 93 if (!isset($response['access_token'])) { 94 wp_die(__('Failed to retrieve access token.', 'techvoot-app-firebase')); 95 } 81 96 82 97 return $response['access_token']; -
techvoot-app-firebase/trunk/classes/settings/class-tv-settings-configuration.php
r3259015 r3348046 79 79 80 80 <?php if ($current_tab === 'config'): ?> 81 <form method="post" >81 <form method="post" enctype="multipart/form-data"> 82 82 <?php wp_nonce_field('tv_firebase_update_config_action', 'tv_firebase_config_nonce'); ?> 83 83 <h2><?php echo esc_html__('Firebase Config', 'techvoot-app-firebase'); ?></h2> 84 84 85 <table class="tv-settings tv-settings-general wp-list-table widefat"> 85 86 <tr class="tv-settings" valign="top"> 86 87 <td scope="row"> 87 88 <div class="tv-settings-label-wrap"> 88 <label><strong><?php echo esc_html__(' firebase database name', 'techvoot-app-firebase'); ?>:</strong></label>89 <label><strong><?php echo esc_html__('Firebase Database Name', 'techvoot-app-firebase'); ?>:</strong></label> 89 90 </div> 90 91 <input type="text" name="firebase_database_name" style="width: 350px;" value="<?php echo esc_attr($config_data->firebase_database_name); ?>"> … … 94 95 <td scope="row"> 95 96 <div class="tv-settings-label-wrap"> 96 <label><strong><?php echo esc_html__(' firebase key', 'techvoot-app-firebase'); ?>:</strong></label>97 <label><strong><?php echo esc_html__('Firebase Key', 'techvoot-app-firebase'); ?>:</strong></label> 97 98 </div> 98 99 <input type="text" name="firebase_key" style="width: 350px;" value="<?php echo esc_attr($config_data->firebase_key); ?>"> … … 102 103 <td scope="row"> 103 104 <div class="tv-settings-label-wrap"> 104 <label><strong><?php echo esc_html__(' firebase notification server key', 'techvoot-app-firebase'); ?>:</strong></label>105 <label><strong><?php echo esc_html__('Firebase Notification Server Key', 'techvoot-app-firebase'); ?>:</strong></label> 105 106 </div> 106 107 <input type="text" name="firebase_notification_key" style="width: 350px;" value="<?php echo esc_attr($config_data->firebase_notification_key); ?>"> 107 108 </td> 108 109 </tr> 110 <tr class="tv-settings" valign="top"> 111 <td scope="row"> 112 <div class="tv-settings-label-wrap"> 113 <label><strong><?php echo esc_html__('Upload Firebase JSON Key', 'techvoot-app-firebase'); ?>:</strong></label> 114 </div> 115 <input type="file" name="firebase_json_key"> 116 <?php 117 $json_file = get_option('tv_firebase_json_key', ''); 118 if ($json_file) { 119 echo '<p>Current File: <code>' . esc_html(basename($json_file)) . '</code></p>'; 120 } 121 ?> 122 </td> 123 </tr> 109 124 </table> 125 110 126 <br> 111 127 <input type="submit" name="updateConfig" class="button button-primary button-large" value="<?php echo esc_attr__('Save Changes', 'techvoot-app-firebase'); ?>"> … … 217 233 $firebase_notification_key = isset($_POST['firebase_notification_key']) ? sanitize_text_field($_POST['firebase_notification_key']) : ''; 218 234 235 // Handle Firebase JSON Key Upload 236 $firebase_json_key_path = get_option('tv_firebase_json_key', ''); // Retrieve existing file path 237 238 if (!empty($_FILES['firebase_json_key']['name'])) { 239 $uploaded_file = $_FILES['firebase_json_key']; 240 241 // Ensure file is JSON 242 if ($uploaded_file['type'] !== 'application/json') { 243 wp_die(__('Only JSON files are allowed.', 'techvoot-app-firebase')); 244 } 245 246 $upload_dir = wp_upload_dir(); 247 $target_path = $upload_dir['basedir'] . '/firebase_keys/'; 248 if (!file_exists($target_path)) { 249 wp_mkdir_p($target_path); 250 } 251 252 $file_path = $target_path . basename($uploaded_file['name']); 253 if (move_uploaded_file($uploaded_file['tmp_name'], $file_path)) { 254 $firebase_json_key_path = $file_path; 255 update_option('tv_firebase_json_key', $firebase_json_key_path); 256 } else { 257 wp_die(__('File upload failed.', 'techvoot-app-firebase')); 258 } 259 } 260 261 // Save config data including JSON file path 219 262 $this->update_config_data($firebase_database_name, $firebase_key, $firebase_notification_key, '', '', '', '', '', '', ''); 220 263 } -
techvoot-app-firebase/trunk/readme.txt
r3269329 r3348046 1 === Wordpress Firebase Push Notification===1 === Firebase Push Notifier === 2 2 Contributors: techvootsolutions 3 3 Tags: firebase, notification 4 4 Requires at least: 6.5 5 Tested up to: 6.8 6 Stable tag: 1.0. 15 Tested up to: 6.8 6 Stable tag: 1.0.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 13 13 == Description == 14 14 15 The Wordpress Firebase Push Notification plugin seamlessly integrates your WordPress store with the Wordpress Firebase Push NotificationFirestore database. It enables real-time synchronization of user data and other relevant information between Firebase and your WordPress site, ensuring a smooth and efficient data flow.15 The Firebase Push Notifier plugin seamlessly integrates your WordPress store with the Firebase Push Notifier Firestore database. It enables real-time synchronization of user data and other relevant information between Firebase and your WordPress site, ensuring a smooth and efficient data flow. 16 16 17 17 Additionally, the plugin offers Firebase user notification functionality, allowing you to send automated notifications to users based on a cron job. This ensures that your users receive timely updates without any manual effort. … … 32 32 - Log in to your WordPress Admin Dashboard. 33 33 - Navigate to **Plugins > Installed Plugins**. 34 - Find ** Wordpress Firebase Push Notification** and click **Activate**.34 - Find **Firebase Push Notifier** and click **Activate**. 35 35 36 36 2. **Configure the Plugin:** -
techvoot-app-firebase/trunk/techvoot-app-firebase.php
r3269329 r3348046 1 1 <?php 2 2 /* 3 Plugin Name: WordPress Firebase Push Notification3 Plugin Name: Firebase Push Notifier 4 4 Description: Techvoot WordPress-based Firebase Push Notification Plugin. 5 Version: 1.0. 15 Version: 1.0.2 6 6 Author: Techvoot 7 7 License: GPLv2 or later
Note: See TracChangeset
for help on using the changeset viewer.