Plugin Directory

Changeset 3373519


Ignore:
Timestamp:
10/06/2025 09:05:11 AM (5 months ago)
Author:
digitalapps
Message:

1.3.3

Location:
wp-swiper/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • wp-swiper/trunk/README.txt

    r3373095 r3373519  
    120120== Changelog ==
    121121
     122= 1.3.3 =
     123* Refactor asset paths to use DAWPS_PLUGIN_URL and DAWPS_PLUGIN_PATH constants for consistency
     124
    122125= 1.3.1 =
    123126* Added an ability to reset Overlay Color by pressing a button
  • wp-swiper/trunk/includes/admin/class-wp-swiper-admin.php

    r3373100 r3373519  
    8686        wp_enqueue_style(
    8787            $this->plugin_name . '-block-editor-style',
    88             plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . "css/admin_block.css",
     88            DAWPS_PLUGIN_URL . "css/admin_block.css",
    8989            array(),
    9090            '1.0.0'
     
    100100
    101101        // Check if we have the new build assets
    102         $plugin_dir_path = dirname( dirname( __DIR__ ) ) . '/';
    103         $plugin_dir_url = plugin_dir_url( dirname( dirname( __DIR__ ) ) );
    104         $asset_file_path = $plugin_dir_path . 'build/index.build.asset.php';
    105         // Applications/MAMP/htdocs/wp-content/plugins/wp-swiper/build/index.build.asset.php
     102        $asset_file_path = DAWPS_PLUGIN_PATH . 'build/index.build.asset.php';
    106103
    107104        if (file_exists($asset_file_path)) {
     
    109106            $dependencies = isset($asset_file['dependencies']) ? $asset_file['dependencies'] : array('wp-blocks', 'wp-element');
    110107            $version = isset($asset_file['version']) ? $asset_file['version'] : DAWPS_PLUGIN_VERSION;
    111             $script_url = $plugin_dir_url . 'build/index.build.js';
     108            $script_url = DAWPS_PLUGIN_URL . 'build/index.build.js';
    112109        } else {
    113110            // Minimal fallback - let WordPress handle most dependencies automatically
    114111            $dependencies = array('wp-blocks', 'wp-element');
    115112            $version = DAWPS_PLUGIN_VERSION;
    116             $script_url = $plugin_dir_url . 'gutenberg/js/admin_block.js';
     113            $script_url = DAWPS_PLUGIN_URL . 'gutenberg/js/admin_block.js';
    117114        }
    118115
  • wp-swiper/trunk/includes/blocks/class-wp-swiper-block-registration.php

    r3373100 r3373519  
    6565    function read_json() {
    6666        // Define the path to the JSON file - use slides block.json as primary
    67         $filePath = plugin_dir_path(dirname(dirname(__FILE__))) . 'build/blocks/slides/block.json';
     67        $filePath = DAWPS_PLUGIN_PATH . 'build/blocks/slides/block.json';
    6868
    6969        // Check if the file exists and is readable
     
    100100        }
    101101
    102         $plugin_dir_path = plugin_dir_path(dirname(dirname(__FILE__)));
    103         $plugin_dir_url = plugin_dir_url(dirname(dirname(__FILE__)));
    104         $asset_file_path = $plugin_dir_path . 'build/index.build.asset.php';
     102        $asset_file_path = DAWPS_PLUGIN_PATH . 'build/index.build.asset.php';
    105103       
    106104        if (file_exists($asset_file_path)) {
     
    116114        wp_register_script(
    117115            $this->block_name,
    118             $plugin_dir_url . 'build/index.build.js',
     116            DAWPS_PLUGIN_URL . 'build/index.build.js',
    119117            $dependencies,
    120118            $version
     
    124122       
    125123        // Enqueue editor styles
    126         $editor_css_path = $plugin_dir_path . 'build/index.css';
     124        $editor_css_path = DAWPS_PLUGIN_PATH . 'build/index.css';
    127125        if (file_exists($editor_css_path)) {
    128126            wp_enqueue_style(
    129127                $this->block_name . '-editor',
    130                 $plugin_dir_url . 'build/index.css',
     128                DAWPS_PLUGIN_URL . 'build/index.css',
    131129                array(),
    132130                $version
     
    146144
    147145        $renderer = new WP_Swiper_Renderer();
    148         $plugin_dir_path = plugin_dir_path(dirname(dirname(__FILE__)));
    149146
    150147        // Register slides block
    151         $slides_block_path = $plugin_dir_path . 'build/blocks/slides';
     148        $slides_block_path = DAWPS_PLUGIN_PATH . 'build/blocks/slides';
    152149        if (file_exists($slides_block_path . '/block.json')) {
    153150            register_block_type($slides_block_path, array(
     
    157154
    158155        // Register slide block
    159         $slide_block_path = $plugin_dir_path . 'build/blocks/slide';
     156        $slide_block_path = DAWPS_PLUGIN_PATH . 'build/blocks/slide';
    160157        if (file_exists($slide_block_path . '/block.json')) {
    161158            register_block_type($slide_block_path, array(
     
    171168     */
    172169    function enqueue_frontend_assets() {
    173         if (!is_admin()) { // Ensures the styles are not loaded in the admin area
    174             $plugin_dir_path = plugin_dir_path(dirname(dirname(__FILE__)));
    175             $plugin_dir_url = plugin_dir_url(dirname(dirname(__FILE__)));
    176            
     170        if (!is_admin()) { // Ensures the styles are not loaded in the admin area           
    177171            // Convert the URL to a file path
    178             $script_path = $plugin_dir_path . 'build/frontend.build.js';
    179             $style_path = $plugin_dir_path . 'build/frontend.css';
     172            $script_path = DAWPS_PLUGIN_PATH . 'build/frontend.build.js';
     173            $style_path = DAWPS_PLUGIN_PATH . 'build/frontend.css';
    180174
    181175            // Check if the file exists
     
    183177                wp_enqueue_script(
    184178                    $this->block_name . '-frontend',
    185                     $plugin_dir_url . 'build/frontend.build.js',
     179                    DAWPS_PLUGIN_URL . 'build/frontend.build.js',
    186180                    array('jquery'),
    187181                    DAWPS_PLUGIN_VERSION
     
    193187                wp_enqueue_style(
    194188                    $this->block_name . '-frontend',
    195                     $plugin_dir_url . 'build/frontend.css',
     189                    DAWPS_PLUGIN_URL . 'build/frontend.css',
    196190                    array(),
    197191                    DAWPS_PLUGIN_VERSION
  • wp-swiper/trunk/includes/core/class-wp-swiper.php

    r3373100 r3373519  
    11<?php
    22
    3 class WP_Swiper {
    4    
    5     protected $loader;
    6     protected $plugin_prefix;
    7     protected $plugin_name;
    8     protected $version;
    9     protected $block_settings;
     3class WP_Swiper
     4{
    105
    11     function __construct() {
    12         if ( defined( 'DAWPS_PLUGIN_VERSION' ) ) {
    13             $this->version = DAWPS_PLUGIN_VERSION;
    14         } else {
    15             $this->version = '1.2.18';
    16         }
    17         $this->plugin_prefix = 'dawps';
    18         $this->plugin_name = 'wpswiper';
     6    protected $loader;
     7    protected $plugin_prefix;
     8    protected $plugin_name;
     9    protected $version;
     10    protected $block_settings;
    1911
    20         $this->load_dependencies();
    21         $this->define_admin_hooks();
    22         $this->define_public_hooks();
    23         $this->init_block_registration();
     12    function __construct()
     13    {
     14        if (defined('DAWPS_PLUGIN_VERSION')) {
     15            $this->version = DAWPS_PLUGIN_VERSION;
     16        } else {
     17            $this->version = '1.2.18';
     18        }
     19        $this->plugin_prefix = 'dawps';
     20        $this->plugin_name = 'wpswiper';
    2421
    25     }
    26    
    27     private function load_dependencies() {
    28         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wp-swiper-settings.php';
    29         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'core/class-wp-swiper-loader.php';
    30         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wp-swiper-admin.php';
    31         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'blocks/class-wp-swiper-block-detector.php';
    32         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wp-swiper-public.php';
    33         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'blocks/class-wp-swiper-renderer.php';
    34         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'blocks/class-wp-swiper-block-registration.php';
     22        $this->load_dependencies();
     23        $this->define_admin_hooks();
     24        $this->define_public_hooks();
     25        $this->init_block_registration();
     26    }
    3527
    36         $this->loader = new WP_Swiper_Loader();
    37     }
     28    private function load_dependencies()
     29    {
     30        require_once DAWPS_PLUGIN_PATH . 'includes/admin/class-wp-swiper-settings.php';
     31        require_once DAWPS_PLUGIN_PATH . 'includes/core/class-wp-swiper-loader.php';
     32        require_once DAWPS_PLUGIN_PATH . 'includes/admin/class-wp-swiper-admin.php';
     33        require_once DAWPS_PLUGIN_PATH . 'includes/blocks/class-wp-swiper-block-detector.php';
     34        require_once DAWPS_PLUGIN_PATH . 'includes/public/class-wp-swiper-public.php';
     35        require_once DAWPS_PLUGIN_PATH . 'includes/blocks/class-wp-swiper-renderer.php';
     36        require_once DAWPS_PLUGIN_PATH . 'includes/blocks/class-wp-swiper-block-registration.php';
    3837
    39     private function define_admin_hooks() {
     38        $this->loader = new WP_Swiper_Loader();
     39    }
    4040
    41         $plugin_admin = new WP_Swiper_Admin( $this->get_plugin_name(), $this->get_version() );
     41    private function define_admin_hooks()
     42    {
    4243
    43         $this->loader->add_action( 'enqueue_block_editor_assets', $plugin_admin, 'register_gutenberg_block' );
    44         $this->loader->add_action( 'enqueue_block_editor_assets', $plugin_admin, 'enqueue_admin_styles' );
    45        
    46     }
    47    
    48     private function define_public_hooks() {
    49         $plugin_public = new WP_Swiper_Public( $this->get_plugin_name(), $this->get_version() );
     44        $plugin_admin = new WP_Swiper_Admin($this->get_plugin_name(), $this->get_version());
    5045
    51         $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_frontend_assets' );
     46        $this->loader->add_action('enqueue_block_editor_assets', $plugin_admin, 'register_gutenberg_block');
     47        $this->loader->add_action('enqueue_block_editor_assets', $plugin_admin, 'enqueue_admin_styles');
     48    }
    5249
     50    private function define_public_hooks()
     51    {
     52        $plugin_public = new WP_Swiper_Public($this->get_plugin_name(), $this->get_version());
    5353
    54     }
     54        $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_frontend_assets');
     55    }
    5556
    56     /**
    57      * Initialize block registration
    58      *
    59      * @since    1.0.0
    60      */
    61     private function init_block_registration() {
    62         new WP_Swiper_Block_Registration();
    63     }
     57    /**
     58     * Initialize block registration
     59     *
     60     * @since    1.0.0
     61     */
     62    private function init_block_registration()
     63    {
     64        new WP_Swiper_Block_Registration();
     65    }
    6466
    65     function enqueue_admin() {
    66         wp_enqueue_style(
     67    function enqueue_admin()
     68    {
     69        wp_enqueue_style(
    6770            $this->plugin_name . '-block-editor-admin-style',
    68             plugin_dir_path( dirname( __FILE__ ) ) . "/css/admin_block.css",
     71            DAWPS_PLUGIN_URL . "css/admin_block.css",
    6972            array(),
    7073            '1.0.0'
    7174        );
    72     }
    73    
    74     /**
    75      * Run the loader to execute all of the hooks with WordPress.
    76      *
    77      * @since    1.0.0
    78      */
    79     public function run() {
    80         $this->loader->run();
    81     }
     75    }
    8276
    83     /**
    84      * The name of the plugin used to uniquely identify it within the context of
    85      * WordPress and to define internationalization functionality.
    86      *
    87      * @since     1.0.0
    88      * @return    string    The name of the plugin.
    89      */
    90     public function get_plugin_name() {
    91         return $this->plugin_name;
    92     }
     77    /**
     78     * Run the loader to execute all of the hooks with WordPress.
     79     *
     80     * @since    1.0.0
     81     */
     82    public function run()
     83    {
     84        $this->loader->run();
     85    }
    9386
    94     /**
    95      * Retrieve the version number of the plugin.
    96      *
    97      * @since     1.0.0
    98      * @return    string    The version number of the plugin.
    99      */
    100     public function get_version() {
    101         return $this->version;
    102     }
     87    /**
     88     * The name of the plugin used to uniquely identify it within the context of
     89     * WordPress and to define internationalization functionality.
     90     *
     91     * @since     1.0.0
     92     * @return    string    The name of the plugin.
     93     */
     94    public function get_plugin_name()
     95    {
     96        return $this->plugin_name;
     97    }
    10398
    104     /**
    105      * Retrieve the prefix of the plugin.
    106      *
    107      * @since     1.0.0
    108      * @return    string    The prefix of the plugin.
    109      */
    110     public function get_prefix() {
    111         return $this->plugin_prefix;
    112     }
     99    /**
     100     * Retrieve the version number of the plugin.
     101     *
     102     * @since     1.0.0
     103     * @return    string    The version number of the plugin.
     104     */
     105    public function get_version()
     106    {
     107        return $this->version;
     108    }
     109
     110    /**
     111     * Retrieve the prefix of the plugin.
     112     *
     113     * @since     1.0.0
     114     * @return    string    The prefix of the plugin.
     115     */
     116    public function get_prefix()
     117    {
     118        return $this->plugin_prefix;
     119    }
    113120}
  • wp-swiper/trunk/includes/public/class-wp-swiper-public.php

    r3373100 r3373519  
    143143        $frontend_js_path = plugin_dir_path(__DIR__) . 'build/frontend.build.js';
    144144
    145         if (file_exists($frontend_css_path)) {
    146             wp_enqueue_style(
    147                 $this->plugin_name . '-block-frontend',
    148                 plugin_dir_url(__DIR__) . 'build/frontend.css',
    149                 array(),
    150                 DAWPS_PLUGIN_VERSION
    151             );
    152         }
     145    if (file_exists($frontend_css_path)) {
     146        wp_enqueue_style(
     147            $this->plugin_name . '-block-frontend',
     148            DAWPS_PLUGIN_URL . 'build/frontend.css',
     149            array(),
     150            DAWPS_PLUGIN_VERSION
     151        );
     152    }
    153153
    154154    wp_enqueue_style(
    155         $this->plugin_name . '-bundle-css',
    156         plugin_dir_url(dirname(__DIR__)) .  'assets/swiper/swiper-bundle.min.css',
    157         array(),
    158         DAWPS_BUNDLE_VERSION
    159     );
    160 
    161     wp_register_script(
    162         $this->plugin_name . '-bundle',
    163         plugin_dir_url(dirname(__DIR__)) .  'assets/swiper/swiper-bundle.min.js',
    164         array(),
    165         DAWPS_BUNDLE_VERSION
    166     );
     155    $this->plugin_name . '-bundle-css',
     156    DAWPS_PLUGIN_URL .  'assets/swiper/swiper-bundle.min.css',
     157    array(),
     158    DAWPS_BUNDLE_VERSION
     159);
     160
     161wp_register_script(
     162    $this->plugin_name . '-bundle',
     163    DAWPS_PLUGIN_URL .  'assets/swiper/swiper-bundle.min.js',
     164    array(),
     165    DAWPS_BUNDLE_VERSION
     166);
    167167
    168168        wp_enqueue_script(
     
    175175            $register_args = [
    176176                'handle'    => $this->plugin_name . '-frontend-js',
    177                 'src'       => plugin_dir_url(__DIR__) . 'build/frontend.build.js',
     177                'src'       => DAWPS_PLUGIN_URL . 'build/frontend.build.js',
    178178                'deps'      => [$this->plugin_name . '-bundle'],
    179179                'ver'       => DAWPS_PLUGIN_VERSION,
  • wp-swiper/trunk/wp-swiper.php

    r3373102 r3373519  
    1717 * Plugin URI:        https://digitalapps.com/wp-swiper/
    1818 * Description:       Swiper JS as a Gutenberg Block.
    19  * Version:           1.3.2
     19 * Version:           1.3.3
    2020 * Author:            Digital Apps
    2121 * Author URI:        https://digitalapps.com/
     
    3232}
    3333
    34 define( 'DAWPS_PLUGIN_VERSION', '1.3.2' );
    35 define( 'DAWPS_BUNDLE_VERSION', '11.1.14' );
     34define( 'DAWPS_PLUGIN_VERSION', '1.3.3' );
     35define( 'DAWPS_BUNDLE_VERSION', '12.0.2' );
     36define( 'DAWPS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     37define( 'DAWPS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
    3638
    3739function activate_wpswiper() {
Note: See TracChangeset for help on using the changeset viewer.