Plugin Directory

Changeset 3348046


Ignore:
Timestamp:
08/21/2025 10:38:46 AM (6 months ago)
Author:
techvootsolutions
Message:

Updated plugin name and assets

Location:
techvoot-app-firebase/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • techvoot-app-firebase/trunk/classes/class-tv-push-notification.php

    r3259015 r3348046  
    4444        private function getAccessToken()
    4545        {
    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
    4754            $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            }
    4859
    4960            $token_uri = 'https://oauth2.googleapis.com/token';
     
    5465
    5566            $assertion = [
    56                 'iss' => $credentials['client_email'],
     67                'iss'   => $credentials['client_email'],
    5768                'scope' => 'https://www.googleapis.com/auth/cloud-platform',
    58                 'aud' => $token_uri,
    59                 'iat' => $now,
    60                 'exp' => $exp
     69                'aud'   => $token_uri,
     70                'iat'   => $now,
     71                'exp'   => $exp
    6172            ];
    6273
     
    6677            $postdata = [
    6778                'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer',
    68                 'assertion' => $jwt
     79                'assertion'  => $jwt
    6980            ];
    7081
     
    7990
    8091            $response = json_decode($result, true);
     92
     93            if (!isset($response['access_token'])) {
     94                wp_die(__('Failed to retrieve access token.', 'techvoot-app-firebase'));
     95            }
    8196
    8297            return $response['access_token'];
  • techvoot-app-firebase/trunk/classes/settings/class-tv-settings-configuration.php

    r3259015 r3348046  
    7979
    8080                <?php if ($current_tab === 'config'): ?>
    81                     <form method="post">
     81                    <form method="post" enctype="multipart/form-data">
    8282                        <?php wp_nonce_field('tv_firebase_update_config_action', 'tv_firebase_config_nonce'); ?>
    8383                        <h2><?php echo esc_html__('Firebase Config', 'techvoot-app-firebase'); ?></h2>
     84
    8485                        <table class="tv-settings tv-settings-general wp-list-table widefat">
    8586                            <tr class="tv-settings" valign="top">
    8687                                <td scope="row">
    8788                                    <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>
    8990                                    </div>
    9091                                    <input type="text" name="firebase_database_name" style="width: 350px;" value="<?php echo esc_attr($config_data->firebase_database_name); ?>">
     
    9495                                <td scope="row">
    9596                                    <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>
    9798                                    </div>
    9899                                    <input type="text" name="firebase_key" style="width: 350px;" value="<?php echo esc_attr($config_data->firebase_key); ?>">
     
    102103                                <td scope="row">
    103104                                    <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>
    105106                                    </div>
    106107                                    <input type="text" name="firebase_notification_key" style="width: 350px;" value="<?php echo esc_attr($config_data->firebase_notification_key); ?>">
    107108                                </td>
    108109                            </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>
    109124                        </table>
     125
    110126                        <br>
    111127                        <input type="submit" name="updateConfig" class="button button-primary button-large" value="<?php echo esc_attr__('Save Changes', 'techvoot-app-firebase'); ?>">
     
    217233            $firebase_notification_key = isset($_POST['firebase_notification_key']) ? sanitize_text_field($_POST['firebase_notification_key']) : '';
    218234
     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
    219262            $this->update_config_data($firebase_database_name, $firebase_key, $firebase_notification_key, '', '', '', '', '', '', '');
    220263        }
  • techvoot-app-firebase/trunk/readme.txt

    r3269329 r3348046  
    1 === Wordpress Firebase Push Notification ===
     1=== Firebase Push Notifier ===
    22Contributors: techvootsolutions 
    33Tags: firebase, notification 
    44Requires at least: 6.5 
    5 Tested up to: 6.8  
    6 Stable tag: 1.0.1 
     5Tested up to: 6.8
     6Stable tag: 1.0.2 
    77Requires PHP: 7.4 
    88License: GPLv2 or later 
     
    1313== Description == 
    1414
    15 The Wordpress Firebase Push Notification plugin seamlessly integrates your WordPress store with the Wordpress Firebase Push Notification 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. 
     15The 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. 
    1616
    1717Additionally, 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. 
     
    3232   - Log in to your WordPress Admin Dashboard. 
    3333   - Navigate to **Plugins > Installed Plugins**. 
    34    - Find **Wordpress Firebase Push Notification** and click **Activate**. 
     34   - Find **Firebase Push Notifier** and click **Activate**. 
    3535
    36362. **Configure the Plugin:** 
  • techvoot-app-firebase/trunk/techvoot-app-firebase.php

    r3269329 r3348046  
    11<?php
    22/*
    3 Plugin Name:  WordPress Firebase Push Notification
     3Plugin Name:  Firebase Push Notifier
    44Description:  Techvoot WordPress-based Firebase Push Notification Plugin.
    5 Version:      1.0.1
     5Version:      1.0.2
    66Author:       Techvoot
    77License:      GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.