Plugin Directory

Changeset 3472089


Ignore:
Timestamp:
03/01/2026 01:57:36 PM (5 weeks ago)
Author:
buddydevelopers
Message:

Tag version 1.0.4

Location:
geobuddy
Files:
518 added
3 edited

Legend:

Unmodified
Added
Removed
  • geobuddy/trunk/admin/class-admin.php

    r3370702 r3472089  
    55 * Admin Class
    66 *
     7 * Handles admin pages, settings, and provides hooks for addons to register their own settings tabs.
     8 *
    79 * @package    Geobuddy
    810 * @subpackage Geobuddy/admin
    911 * @author     Naveen Giri
     12 *
     13 * @since 1.0.3
     14 *
     15 * Hook for Addons:
     16 * Addons can register their own settings tabs using the 'geobuddy_register_settings_tabs' action:
     17 *
     18 * add_action('geobuddy_register_settings_tabs', function($admin_instance) {
     19 *     $admin_instance->register_settings_tab(array(
     20 *         'id'       => 'my-addon-tab',
     21 *         'title'    => __('My Addon', 'textdomain'),
     22 *         'callback' => 'my_addon_render_tab',
     23 *         'priority' => 20
     24 *     ));
     25 * });
    1026 */
    1127class BD_GEOBUDDY_Admin {
     28
     29    /**
     30     * Registered tabs
     31     *
     32     * @var array
     33     */
     34    private $settings_tabs = array();
    1235
    1336    /**
     
    1740        add_action('admin_menu', array($this, 'add_menu_page'));
    1841        add_action('admin_init', array($this, 'register_settings'));
    19     }
    20 
    21     /**
    22      * Add menu page
     42        add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets'));
     43       
     44        // Initialize default General tab
     45        $this->register_default_tabs();
     46       
     47        // Allow addons to register their tabs
     48        add_action('geobuddy_register_settings_tabs', array($this, 'register_addon_tabs'), 10);
     49    }
     50
     51    /**
     52     * Add menu page and submenu pages
    2353     */
    2454    public function add_menu_page() {
     55        // Main menu page (Welcome page)
    2556        add_menu_page(
    26             __('GeoBuddy Settings', 'geobuddy'),
     57            __('GeoBuddy', 'geobuddy'),
    2758            __('GeoBuddy', 'geobuddy'),
    2859            'manage_options',
    2960            'geobuddy',
    30             array($this, 'render_settings_page'),
     61            array($this, 'render_welcome_page'),
    3162            'dashicons-admin-site',
    3263            25
    3364        );
     65
     66        // Welcome submenu (same as main page)
     67        add_submenu_page(
     68            'geobuddy',
     69            __('Welcome', 'geobuddy'),
     70            __('Welcome', 'geobuddy'),
     71            'manage_options',
     72            'geobuddy',
     73            array($this, 'render_welcome_page')
     74        );
     75
     76        // Settings submenu
     77        add_submenu_page(
     78            'geobuddy',
     79            __('Settings', 'geobuddy'),
     80            __('Settings', 'geobuddy'),
     81            'manage_options',
     82            'geobuddy-settings',
     83            array($this, 'render_settings_page')
     84        );
     85    }
     86
     87    /**
     88     * Enqueue admin assets
     89     */
     90    public function enqueue_admin_assets($hook) {
     91        // Only load on GeoBuddy admin pages
     92        // if (strpos($hook, 'geobuddy') === false) {
     93        //     return;
     94        // }
     95
     96        wp_enqueue_style(
     97            'geobuddy-admin',
     98            BD_GEOBUDDY_PLUGIN_URL . 'admin/css/geobuddy-admin.css',
     99            array(),
     100            BD_GEOBUDDY_VERSION
     101        );
     102
     103        // Enqueue JavaScript for settings page tabs
     104        if (strpos($hook, 'geobuddy-settings') !== false) {
     105            wp_enqueue_script(
     106                'geobuddy-admin',
     107                BD_GEOBUDDY_PLUGIN_URL . 'admin/js/geobuddy-admin.js',
     108                array('jquery'),
     109                BD_GEOBUDDY_VERSION,
     110                true
     111            );
     112        }
    34113    }
    35114
     
    60139            __('Social Media Fields', 'geobuddy'),
    61140            array($this, 'section_callback'),
    62             'geobuddy'
     141            'geobuddy-settings'
    63142        );
    64143
     
    78157                $field_label,
    79158                array($this, 'custom_field_callback'),
    80                 'geobuddy',
     159                'geobuddy-settings',
    81160                'bd_geobuddy_custom_fields_section',
    82161                array('field_id' => $field_id)
     
    141220
    142221    /**
     222     * Render welcome page
     223     */
     224    public function render_welcome_page() {
     225        if (!current_user_can('manage_options')) {
     226            return;
     227        }
     228
     229        // Render header
     230        $this->render_header();
     231       
     232        // Load welcome view
     233        $this->load_view('welcome');
     234       
     235        // Render footer
     236        $this->render_footer();
     237    }
     238
     239    /**
     240     * Register default tabs
     241     */
     242    private function register_default_tabs() {
     243        // Register General tab
     244        $this->register_settings_tab(array(
     245            'id'       => 'general',
     246            'title'    => __('General', 'geobuddy'),
     247            'callback' => array($this, 'render_general_tab'),
     248            'priority' => 10
     249        ));
     250    }
     251
     252    /**
     253     * Register settings tab
     254     *
     255     * This method allows addons to register their own settings tabs in the GeoBuddy Settings page.
     256     *
     257     * @param array $args {
     258     *     Tab configuration arguments.
     259     *
     260     *     @type string   $id       Unique identifier for the tab (slug). Required.
     261     *     @type string   $title    Display title for the tab. Required.
     262     *     @type callable $callback Function or method to render the tab content. Required.
     263     *     @type int      $priority Priority/order of the tab (lower = earlier). Default: 20.
     264     *                              General tab uses priority 10.
     265     * }
     266     * @return bool True on success, false on failure.
     267     *
     268     * @example
     269     * $admin_instance->register_settings_tab(array(
     270     *     'id'       => 'my-addon',
     271     *     'title'    => __('My Addon', 'textdomain'),
     272     *     'callback' => 'my_addon_render_tab',
     273     *     'priority' => 20
     274     * ));
     275     */
     276    public function register_settings_tab($args) {
     277        $defaults = array(
     278            'id'       => '',
     279            'title'    => '',
     280            'callback' => '',
     281            'priority' => 20
     282        );
     283
     284        $args = wp_parse_args($args, $defaults);
     285
     286        if (empty($args['id']) || empty($args['title']) || empty($args['callback'])) {
     287            return false;
     288        }
     289
     290        // Validate callback is callable
     291        if (!is_callable($args['callback'])) {
     292            return false;
     293        }
     294
     295        $this->settings_tabs[$args['id']] = $args;
     296        return true;
     297    }
     298
     299    /**
     300     * Get registered tabs
     301     *
     302     * @return array
     303     */
     304    public function get_settings_tabs() {
     305        // Trigger action for addons to register tabs
     306        do_action('geobuddy_register_settings_tabs', $this);
     307       
     308        // Sort tabs by priority
     309        uasort($this->settings_tabs, function($a, $b) {
     310            return $a['priority'] - $b['priority'];
     311        });
     312
     313        return $this->settings_tabs;
     314    }
     315
     316    /**
     317     * Register addon tabs (called via action hook)
     318     */
     319    public function register_addon_tabs($admin_instance) {
     320        // This method allows addons to call register_settings_tab via the hook
     321        // Addons will use: do_action('geobuddy_register_settings_tabs', $this);
     322    }
     323
     324    /**
    143325     * Render settings page
    144326     */
     
    147329            return;
    148330        }
     331       
     332        // Get active tab from URL
     333        $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'general';
     334       
     335        // Get all registered tabs
     336        $tabs = $this->get_settings_tabs();
     337       
     338        // Validate active tab
     339        if (!isset($tabs[$active_tab])) {
     340            $active_tab = 'general';
     341        }
     342       
     343        // Render header
     344        $this->render_header();
     345       
     346        // Load settings tabs view
     347        $this->load_view('settings-tabs', array(
     348            'tabs'       => $tabs,
     349            'active_tab' => $active_tab
     350        ));
     351       
     352        // Render footer
     353        $this->render_footer();
     354    }
     355
     356    /**
     357     * Render General tab content
     358     */
     359    public function render_general_tab() {
     360        $options = get_option('bd_geobuddy_custom_fields', array());
     361        $custom_fields = array(
     362            'linkedin'     => __('LinkedIn Profile', 'geobuddy'),
     363            'whatsapp'     => __('WhatsApp', 'geobuddy'),
     364            'tiktok'       => __('TikTok Profile', 'geobuddy'),
     365            'youtube'      => __('YouTube Channel', 'geobuddy'),
     366            'skype'        => __('Skype', 'geobuddy'),
     367            'virtual_tour' => __('360° Virtual Tour URL', 'geobuddy')
     368        );
    149369        ?>
    150         <div class="wrap">
    151             <h1><?php echo esc_html(get_admin_page_title()); ?></h1>
    152             <form action="options.php" method="post">
    153                 <?php
    154                 settings_fields('bd_geobuddy_options');
    155                 do_settings_sections('geobuddy');
    156                 submit_button();
    157                 ?>
     370        <div class="general-settings">
     371            <form method="post" action="options.php">
     372                <?php settings_fields('bd_geobuddy_options'); ?>
     373               
     374                <h3><?php esc_html_e('Custom Fields Settings', 'geobuddy'); ?></h3>
     375                <p><?php esc_html_e('Enable or disable custom fields for your GeoDirectory listings.', 'geobuddy'); ?></p>
     376               
     377                <table class="form-table" role="presentation">
     378                    <tbody>
     379                        <?php foreach ($custom_fields as $field_id => $field_label) :
     380                            $checked = isset($options[$field_id]) && $options[$field_id] == 1;
     381                        ?>
     382                            <tr>
     383                                <th scope="row"><?php echo esc_html($field_label); ?></th>
     384                                <td>
     385                                    <label>
     386                                        <input type="checkbox"
     387                                               name="bd_geobuddy_custom_fields[<?php echo esc_attr($field_id); ?>]"
     388                                               value="1"
     389                                               <?php checked(true, $checked); ?>>
     390                                        <?php esc_html_e('Enable this field', 'geobuddy'); ?>
     391                                    </label>
     392                                </td>
     393                            </tr>
     394                        <?php endforeach; ?>
     395                    </tbody>
     396                </table>
     397               
     398                <p class="submit">
     399                    <?php submit_button(__('Save Changes', 'geobuddy'), 'primary', 'submit', false); ?>
     400                </p>
    158401            </form>
    159402        </div>
    160403        <?php
    161404    }
     405
     406    /**
     407     * Render header
     408     */
     409    private function render_header() {
     410        $this->load_view('header');
     411    }
     412
     413    /**
     414     * Render footer
     415     */
     416    private function render_footer() {
     417        $this->load_view('footer');
     418    }
     419
     420    /**
     421     * Load admin view file
     422     *
     423     * @param string $view_name View file name without .php extension
     424     * @param array  $args      Variables to pass to the view
     425     */
     426    private function load_view($view_name, $args = array()) {
     427        extract($args);
     428        $view_file = BD_GEOBUDDY_PLUGIN_DIR . 'admin/views/' . $view_name . '.php';
     429       
     430        if (file_exists($view_file)) {
     431            include $view_file;
     432        } else {
     433            echo '<div class="error"><p>' . esc_html__('View file not found.', 'geobuddy') . '</p></div>';
     434        }
     435    }
    162436}
    163437endif;
  • geobuddy/trunk/geobuddy.php

    r3370702 r3472089  
    44 * Description: A simple plugin with GeoDirectory custom fields and settings
    55 * Requires Plugins: geodirectory
    6  * Version: 1.0.3
     6 * Version: 1.0.4
    77 * Author: BuddyDevelopers
    88 * Author URI: https://buddydevelopers.com
     
    2323
    2424// Define plugin constants.
    25 define( 'BD_GEOBUDDY_VERSION', '1.0.3' );
     25define( 'BD_GEOBUDDY_VERSION', '1.0.4' );
    2626define( 'BD_GEOBUDDY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    2727define( 'BD_GEOBUDDY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     
    2929// Include the main plugin class.
    3030require_once BD_GEOBUDDY_PLUGIN_DIR . 'class-geobuddy-plugin.php';
     31require_once __DIR__ . '/vendor/autoload.php';
    3132
    3233// Initialize the plugin.
    3334new BD_GEOBUDDY_Plugin();
     35
     36// Freemius SDK integration.
     37if ( ! function_exists( 'geobuddy_fs' ) ) {
     38    // Create a helper function for easy SDK access.
     39    function geobuddy_fs() {
     40        global $geobuddy_fs;
     41
     42        if ( ! isset( $geobuddy_fs ) ) {
     43            // Include Freemius SDK.
     44            // SDK is auto-loaded through Composer
     45
     46            $geobuddy_fs = fs_dynamic_init( array(
     47                'id'                  => '17588',
     48                'slug'                => 'geobuddy',
     49                'premium_slug'        => 'geobuddy-pro',
     50                'type'                => 'plugin',
     51                'public_key'          => 'pk_ef77760e0a4dc010bf37a5f8a507e',
     52                'is_premium'          => false,
     53                'premium_suffix'      => '',
     54                // If your plugin is a serviceware, set this option to false.
     55                'has_premium_version' => false,
     56                'has_addons'          => true,
     57                'has_paid_plans'      => false,
     58                // Automatically removed in the free version. If you're not using the
     59                // auto-generated free version, delete this line before uploading to wp.org.
     60                'menu'                => array(
     61                    'slug'           => 'geobuddy',
     62                    'first-path'     => 'admin.php?page=geobuddy',
     63                    'support'        => false,
     64                ),
     65            ) );
     66        }
     67
     68        return $geobuddy_fs;
     69    }
     70
     71    // Init Freemius.
     72    geobuddy_fs();
     73    // Signal that SDK was initiated.
     74    do_action( 'geobuddy_fs_loaded' );
     75}
  • geobuddy/trunk/readme.txt

    r3370702 r3472089  
    1 === GeoBuddy ===
    2 Contributors: buddydevelopers, 1naveengiri
    3 Tags: geodirectory, social media, custom fields, virtual tour, business directory
    4 Requires at least: 5.0
    5 Tested up to: 6.8
    6 Requires PHP: 7.2
    7 Stable tag: 1.0.3
    8 License: GPLv2 or later
    9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
     1=== GeoBuddy === 
     2Contributors: buddydevelopers
     3Tags: geodirectory, social media, custom fields, virtual tour, business directory 
     4Requires at least: 5.0 
     5Tested up to: 6.8 
     6Requires PHP: 7.2 
     7Stable tag: 1.0.
     8License: GPLv2 or later 
     9License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    1010
    1111Enhance your GeoDirectory listings with modern social media fields and virtual tour integration.
    1212
    13 == Description ==
     13---
    1414
    15 GeoBuddy extends GeoDirectory by adding essential modern social media fields and virtual tour capabilities to your listings. Perfect for businesses wanting to showcase their online presence across multiple platforms.
     15## Description
    1616
    17 = Key Features =
     17**GeoBuddy** is a powerful enhancement plugin built specifically for users of GeoDirectory.
    1818
    19 * **Social Media Integration**
    20   * LinkedIn Profile
    21   * WhatsApp Contact
    22   * TikTok Profile
    23   * YouTube Channel
    24   * Skype Username
     19It helps you extend your directory website with modern social media integration, virtual tours, and a growing ecosystem of advanced addons — all designed to improve user engagement and listing quality.
    2520
    26 * **Virtual Tour Support**
    27   * 360° Virtual Tour URLs
    28   * Compatible with Matterport, Google Virtual Tours, and more
    29   * Easy integration with existing listings
     21Built by BuddyDevelopers, GeoBuddy acts as a **foundation plugin** that enables additional premium and free addons to seamlessly integrate with your GeoDirectory-powered website.
    3022
    31 * **Field Management**
    32   * Enable/disable individual fields through admin settings
    33   * Customizable validation patterns
    34   * Professional display with FontAwesome icons
     23Whether you're building a local directory, niche marketplace, or global discovery platform, GeoBuddy gives you the tools to stand out.
    3524
    36 * **GeoDirectory Integration**
    37   * Seamless integration with existing GeoDirectory listings
    38   * Appears in listing details and map bubbles
    39   * Follows GeoDirectory design patterns
     25---
    4026
    41 = Perfect For =
     27## Core Features
    4228
    43 * Real Estate Agencies
    44 * Business Directories
    45 * Tourism Websites
    46 * Local Business Listings
    47 * Restaurant Directories
    48 * Service Provider Directories
     29### 🌐 Social Media Fields for Listings
    4930
    50 = Social Media Fields =
     31Add modern social media profile links directly inside GeoDirectory listings:
    5132
    52 **LinkedIn Profile**: Add professional LinkedIn profile URLs with validation
    53 **WhatsApp**: Direct WhatsApp messaging with customizable default message
    54 **TikTok Profile**: Link to TikTok profiles with proper URL validation
    55 **YouTube Channel**: Connect YouTube channels and content
    56 **Skype**: Enable Skype calling directly from listings
     33- YouTube Profile
     34- LinkedIn Profile
     35- WhatsApp 
     36- TikTok Profile
    5737
    58 = Virtual Tour Integration =
     38Enhance credibility and improve user engagement by allowing visitors to connect instantly.
    5939
    60 Add immersive 360° virtual tours to your listings. Compatible with:
    61 * Matterport
    62 * Google Virtual Tours
    63 * Any HTTPS virtual tour platform
     40---
    6441
    65 == Installation ==
     42### 🎥 Virtual Tour Integration
    6643
    67 1. Upload the 'geobuddy' folder to the `/wp-content/plugins/` directory
    68 2. Activate the plugin through the 'Plugins' menu in WordPress
    69 3. Go to GeoBuddy settings to configure which fields to enable
    70 4. Add the fields to your GeoDirectory post types through the custom fields manager
     44Allow businesses to embed:
    7145
    72 == Frequently Asked Questions ==
     46- 360° Virtual Tours 
    7347
    74 = Does this require GeoDirectory? =
     48Perfect for restaurants, hotels, real estate, gyms, clinics, and more.
    7549
    76 No, GeoBuddy requires GeoDirectory plugin to be installed and activated.
     50---
    7751
    78 = Can I choose which fields to display? =
     52### ⚡ Lightweight & Developer Friendly
    7953
    80 Yes, you can enable or disable individual fields through the GeoBuddy settings page.
     54- Clean WordPress coding standards 
     55- Optimized performance 
     56- Works seamlessly with GeoDirectory custom post types 
     57- Extendable architecture for future addons 
    8158
    82 = How do I customize the WhatsApp message? =
     59---
    8360
    84 You can customize the default WhatsApp message using the 'bd_geobuddy_whatsapp_message' filter in your theme's functions.php file.
     61## Available Addons
    8562
    86 = Is this plugin translation ready? =
     63GeoBuddy is built as a platform. You can enhance it further using the following addons:
    8764
    88 Yes, GeoBuddy is translation-ready and includes a .pot file for translations.
     65### 🔹 Multistep Form 
    8966
    90 = Where can I get support? =
     67Transform the default “Add Listing” page into a clean step-by-step submission process with progress bar support. Reduce form abandonment and increase listing completion rates.
    9168
    92 1. GeoBuddy settings page
    93 2. WordPress support forums
    94 3. [BuddyDevelopers support](https://buddydevelopers.com/support)
     69### 🔹 Private Message 
    9570
    96 == Screenshots ==
     71Allow users and business owners to communicate directly through private messaging.
    9772
    98 1. GeoBuddy admin settings page showing field management options
    99 2. Social media fields displayed on a GeoDirectory listing
    100 3. Custom field manager integration
    101 4. WhatsApp and Skype integration in action
    102 5. Virtual tour field in listing details
     73### 🔹 Confetti 
    10374
    104 == Changelog ==
     75Celebrate successful listing submissions or actions with animated confetti effects to improve user experience.
    10576
    106 = 1.0.3 =
    107 * Maintained WordPress.org compliance with proper text domain usage
    108 * Ensured text domain matches plugin folder name for better compatibility
    109 * Updated version numbering across all files
    110 * Improved plugin documentation and readme
     77### 🔹 Announcement Bar 
    11178
    112 = 1.0.2 =
    113 * Fixed YouTube URL validation pattern to be more accurate
    114 * Improved third-party variable handling for WordPress.org compliance
    115 * Refactored code to use GeoDirectory global variables directly
    116 * Added proper documentation for third-party dependencies
     79Display important announcements across your directory website.
    11780
    118 = 1.0.1 =
    119 * Fixed WPCS coding standards issues
    120 * Improved code organization
    121 * Fixed undefined variable notice
    122 * Removed unnecessary textdomain loading
     81### 🔹 Weather Forecast 
    12382
    124 = 1.0.0 =
    125 * Initial release
    126 * Added social media fields
    127 * Added virtual tour support
    128 * Added field management system
    129 * Added validation for all fields
     83Show real-time weather data on listing pages based on location.
    13084
    131 == Upgrade Notice ==
     85### 🔹 Broadcasting 
    13286
    133 = 1.0.3 =
    134 This version maintains WordPress.org compliance and improves plugin compatibility. Safe update with no breaking changes.
     87Send broadcast messages or notifications to selected users or listing owners.
    13588
    136 = 1.0.2 =
    137 This version includes improved validation patterns and WordPress.org compliance improvements. Update recommended.
     89---
    13890
    139 = 1.0.1 =
    140 This version includes coding standards improvements and bug fixes. Update recommended.
     91## Requirements
    14192
    142 = 1.0.0 =
    143 Initial release of GeoBuddy with social media fields and virtual tour support.
     93- WordPress 5.0 or higher 
     94- PHP 7.2 or higher 
     95- GeoDirectory plugin (required) 
    14496
    145 == Additional Information ==
     97---
    14698
    147 * Requires GeoDirectory Plugin
    148 * For support and feature requests, visit [BuddyDevelopers](https://buddydevelopers.com)
    149 * Documentation available at [GeoBuddy Docs](https://buddydevelopers.com/docs/geobuddy)
     99## Installation
    150100
    151 == Privacy Policy ==
     1011. Upload the `geobuddy` folder to the `/wp-content/plugins/` directory 
     102   OR install via **Plugins → Add New → Upload Plugin**
     1032. Activate the plugin through the ‘Plugins’ menu in WordPress 
     1043. Ensure GeoDirectory is installed and activated 
     1054. Configure settings from the GeoBuddy settings panel 
    152106
    153 GeoBuddy does not collect any personal data. However, the social media links and virtual tour URLs that users add to their listings may be subject to the respective platforms' privacy policies.
     107---
     108
     109## Screenshots
     110
     1111. **Welcome Dashboard** – Overview page with addon cards and quick access options. 
     1122. **Add-Ons Page** – View, manage, and activate available GeoBuddy addons. 
     1133. **Settings Page – Custom Fields** – Enable or disable social media fields and 360° virtual tour URL from the settings panel. 
     114
     115---
     116
     117## Frequently Asked Questions
     118
     119### Does GeoBuddy work without GeoDirectory?
     120
     121No. GeoBuddy requires the GeoDirectory plugin to function.
     122
     123### Is this plugin lightweight?
     124
     125Yes. GeoBuddy is optimized for performance and follows WordPress development standards.
     126
     127### Are addons included in the main plugin?
     128
     129Some features are included, while advanced functionality is available via separate addons.
     130
     131### Is it developer-friendly?
     132
     133Yes. Developers can extend and customize functionality using WordPress hooks and filters.
     134
     135
     136## Changelog
     137
     138### 1.0.4
     139
     140- Improved compatibility with latest WordPress version 
     141- Minor performance improvements 
     142- UI refinements 
     143
     144### 1.0.3
     145
     146- Enhanced social media field validation 
     147- Bug fixes 
     148
     149### 1.0.0
     150
     151- Initial release 
     152
     153---
     154
     155## License
     156
     157This plugin is licensed under the GPLv2 or later. 
     158See: http://www.gnu.org/licenses/gpl-2.0.html 
     159
     160---
     161
     162## Author
     163
     164Developed by **BuddyDevelopers** 
     165Empowering directory websites with smarter solutions 🚀
Note: See TracChangeset for help on using the changeset viewer.