Plugin Directory

Changeset 3241875


Ignore:
Timestamp:
02/17/2025 11:59:27 AM (12 months ago)
Author:
vocalreferences
Message:

fixed initialisations of plugin

Location:
a-testimonial-builder
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • a-testimonial-builder/tags/1.0.0/a-testimonial-builder.php

    r3225086 r3241875  
    1616    exit; // Exit if accessed directly
    1717
     18   
    1819// Define constants
    1920define('ATBS_DIR', plugin_dir_path(__FILE__));
    2021define('ATBS_URL', plugin_dir_url(__FILE__));
    2122
     23// Check if Composer autoloader exists.
     24if (!file_exists(ATBS_DIR . 'vendor/autoload.php')) {
     25
     26    function atbs_plugin_autoload_notice()
     27    {
     28        echo '<div class="notice notice-error"><p><strong>A+ Testimonial Builder:</strong> The Composer autoloader is missing. Please run <code>composer install</code> inside the plugin folder.</p></div>';
     29    }
     30
     31    add_action('admin_notices', 'atbs_plugin_autoload_notice');
     32    return;
     33}
     34
     35// Load Composer autoloader.
     36require_once ATBS_DIR . 'vendor/autoload.php';
     37
     38// Use the correct namespace
     39use DavidWenner\ATestimonialBuilder\ATBS_Hooks;
    2240use DavidWenner\ATestimonialBuilder\ATBS_Main;
    2341
    24 /**
    25  * Checks basic requirements and loads the plugin.
    26  *
    27  * @since 1.0.0
    28  */
    29 function atbs_plugin_load()
    30 {
    31     // Check Composer autoloader exists.
    32     if (!file_exists(ATBS_DIR . 'vendor/autoload.php')) {
    33         add_action('admin_notices', 'wp_plugin_check_display_composer_autoload_notice');
    34         return;
    35     }
     42// Register activation and deactivation hooks
     43register_activation_hook(__FILE__, [ATBS_Hooks::class, 'atbs_activation_hook']);
     44register_deactivation_hook(__FILE__, [ATBS_Hooks::class, 'atbs_deactivation_hook']);
     45register_uninstall_hook(__FILE__, [ATBS_Hooks::class, 'atbs_deactivation_hook']);
    3646
    37     // Load the Composer autoloader.
    38     require_once ATBS_DIR . 'vendor/autoload.php';
    39 
    40     $instance = new ATBS_Main();
    41 }
    42 
    43 atbs_plugin_load();
    44 
     47// Initialize the plugin
     48new ATBS_Main();
  • a-testimonial-builder/tags/1.0.0/includes/ATBS_Main.php

    r3225086 r3241875  
    99use DavidWenner\ATestimonialBuilder\ATBS_FlashMessages;
    1010use DavidWenner\ATestimonialBuilder\ATBS_Shortcodes;
    11 use DavidWenner\ATestimonialBuilder\ATBS_Hooks;
    1211
    1312/**
     
    2625        new ATBS_FlashMessages();
    2726        new ATBS_Shortcodes();
    28 
    29         $hooks = new ATBS_Hooks();
    30 
    31         // Register activation and deactivation hooks
    32         register_activation_hook(__FILE__, [$hooks, 'atbs_activation_hook']);
    33         register_deactivation_hook(__FILE__, [$hooks, 'atbs_deactivation_hook']);
    34         register_uninstall_hook(__FILE__, [$hooks, 'atbs_deactivation_hook']);
    3527    }
    3628}
  • a-testimonial-builder/trunk/a-testimonial-builder.php

    r3225086 r3241875  
    1616    exit; // Exit if accessed directly
    1717
     18   
    1819// Define constants
    1920define('ATBS_DIR', plugin_dir_path(__FILE__));
    2021define('ATBS_URL', plugin_dir_url(__FILE__));
    2122
     23// Check if Composer autoloader exists.
     24if (!file_exists(ATBS_DIR . 'vendor/autoload.php')) {
     25
     26    function atbs_plugin_autoload_notice()
     27    {
     28        echo '<div class="notice notice-error"><p><strong>A+ Testimonial Builder:</strong> The Composer autoloader is missing. Please run <code>composer install</code> inside the plugin folder.</p></div>';
     29    }
     30
     31    add_action('admin_notices', 'atbs_plugin_autoload_notice');
     32    return;
     33}
     34
     35// Load Composer autoloader.
     36require_once ATBS_DIR . 'vendor/autoload.php';
     37
     38// Use the correct namespace
     39use DavidWenner\ATestimonialBuilder\ATBS_Hooks;
    2240use DavidWenner\ATestimonialBuilder\ATBS_Main;
    2341
    24 /**
    25  * Checks basic requirements and loads the plugin.
    26  *
    27  * @since 1.0.0
    28  */
    29 function atbs_plugin_load()
    30 {
    31     // Check Composer autoloader exists.
    32     if (!file_exists(ATBS_DIR . 'vendor/autoload.php')) {
    33         add_action('admin_notices', 'wp_plugin_check_display_composer_autoload_notice');
    34         return;
    35     }
     42// Register activation and deactivation hooks
     43register_activation_hook(__FILE__, [ATBS_Hooks::class, 'atbs_activation_hook']);
     44register_deactivation_hook(__FILE__, [ATBS_Hooks::class, 'atbs_deactivation_hook']);
     45register_uninstall_hook(__FILE__, [ATBS_Hooks::class, 'atbs_deactivation_hook']);
    3646
    37     // Load the Composer autoloader.
    38     require_once ATBS_DIR . 'vendor/autoload.php';
    39 
    40     $instance = new ATBS_Main();
    41 }
    42 
    43 atbs_plugin_load();
    44 
     47// Initialize the plugin
     48new ATBS_Main();
  • a-testimonial-builder/trunk/includes/ATBS_Main.php

    r3225086 r3241875  
    99use DavidWenner\ATestimonialBuilder\ATBS_FlashMessages;
    1010use DavidWenner\ATestimonialBuilder\ATBS_Shortcodes;
    11 use DavidWenner\ATestimonialBuilder\ATBS_Hooks;
    1211
    1312/**
     
    2625        new ATBS_FlashMessages();
    2726        new ATBS_Shortcodes();
    28 
    29         $hooks = new ATBS_Hooks();
    30 
    31         // Register activation and deactivation hooks
    32         register_activation_hook(__FILE__, [$hooks, 'atbs_activation_hook']);
    33         register_deactivation_hook(__FILE__, [$hooks, 'atbs_deactivation_hook']);
    34         register_uninstall_hook(__FILE__, [$hooks, 'atbs_deactivation_hook']);
    3527    }
    3628}
Note: See TracChangeset for help on using the changeset viewer.