Changeset 3373519
- Timestamp:
- 10/06/2025 09:05:11 AM (5 months ago)
- Location:
- wp-swiper/trunk
- Files:
-
- 6 edited
-
README.txt (modified) (1 diff)
-
includes/admin/class-wp-swiper-admin.php (modified) (3 diffs)
-
includes/blocks/class-wp-swiper-block-registration.php (modified) (9 diffs)
-
includes/core/class-wp-swiper.php (modified) (1 diff)
-
includes/public/class-wp-swiper-public.php (modified) (2 diffs)
-
wp-swiper.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-swiper/trunk/README.txt
r3373095 r3373519 120 120 == Changelog == 121 121 122 = 1.3.3 = 123 * Refactor asset paths to use DAWPS_PLUGIN_URL and DAWPS_PLUGIN_PATH constants for consistency 124 122 125 = 1.3.1 = 123 126 * Added an ability to reset Overlay Color by pressing a button -
wp-swiper/trunk/includes/admin/class-wp-swiper-admin.php
r3373100 r3373519 86 86 wp_enqueue_style( 87 87 $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", 89 89 array(), 90 90 '1.0.0' … … 100 100 101 101 // 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'; 106 103 107 104 if (file_exists($asset_file_path)) { … … 109 106 $dependencies = isset($asset_file['dependencies']) ? $asset_file['dependencies'] : array('wp-blocks', 'wp-element'); 110 107 $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'; 112 109 } else { 113 110 // Minimal fallback - let WordPress handle most dependencies automatically 114 111 $dependencies = array('wp-blocks', 'wp-element'); 115 112 $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'; 117 114 } 118 115 -
wp-swiper/trunk/includes/blocks/class-wp-swiper-block-registration.php
r3373100 r3373519 65 65 function read_json() { 66 66 // 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'; 68 68 69 69 // Check if the file exists and is readable … … 100 100 } 101 101 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'; 105 103 106 104 if (file_exists($asset_file_path)) { … … 116 114 wp_register_script( 117 115 $this->block_name, 118 $plugin_dir_url. 'build/index.build.js',116 DAWPS_PLUGIN_URL . 'build/index.build.js', 119 117 $dependencies, 120 118 $version … … 124 122 125 123 // Enqueue editor styles 126 $editor_css_path = $plugin_dir_path. 'build/index.css';124 $editor_css_path = DAWPS_PLUGIN_PATH . 'build/index.css'; 127 125 if (file_exists($editor_css_path)) { 128 126 wp_enqueue_style( 129 127 $this->block_name . '-editor', 130 $plugin_dir_url. 'build/index.css',128 DAWPS_PLUGIN_URL . 'build/index.css', 131 129 array(), 132 130 $version … … 146 144 147 145 $renderer = new WP_Swiper_Renderer(); 148 $plugin_dir_path = plugin_dir_path(dirname(dirname(__FILE__)));149 146 150 147 // Register slides block 151 $slides_block_path = $plugin_dir_path. 'build/blocks/slides';148 $slides_block_path = DAWPS_PLUGIN_PATH . 'build/blocks/slides'; 152 149 if (file_exists($slides_block_path . '/block.json')) { 153 150 register_block_type($slides_block_path, array( … … 157 154 158 155 // Register slide block 159 $slide_block_path = $plugin_dir_path. 'build/blocks/slide';156 $slide_block_path = DAWPS_PLUGIN_PATH . 'build/blocks/slide'; 160 157 if (file_exists($slide_block_path . '/block.json')) { 161 158 register_block_type($slide_block_path, array( … … 171 168 */ 172 169 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 177 171 // 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'; 180 174 181 175 // Check if the file exists … … 183 177 wp_enqueue_script( 184 178 $this->block_name . '-frontend', 185 $plugin_dir_url. 'build/frontend.build.js',179 DAWPS_PLUGIN_URL . 'build/frontend.build.js', 186 180 array('jquery'), 187 181 DAWPS_PLUGIN_VERSION … … 193 187 wp_enqueue_style( 194 188 $this->block_name . '-frontend', 195 $plugin_dir_url. 'build/frontend.css',189 DAWPS_PLUGIN_URL . 'build/frontend.css', 196 190 array(), 197 191 DAWPS_PLUGIN_VERSION -
wp-swiper/trunk/includes/core/class-wp-swiper.php
r3373100 r3373519 1 1 <?php 2 2 3 class WP_Swiper { 4 5 protected $loader; 6 protected $plugin_prefix; 7 protected $plugin_name; 8 protected $version; 9 protected $block_settings; 3 class WP_Swiper 4 { 10 5 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; 19 11 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'; 24 21 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 } 35 27 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'; 38 37 39 private function define_admin_hooks() { 38 $this->loader = new WP_Swiper_Loader(); 39 } 40 40 41 $plugin_admin = new WP_Swiper_Admin( $this->get_plugin_name(), $this->get_version() ); 41 private function define_admin_hooks() 42 { 42 43 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()); 50 45 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 } 52 49 50 private function define_public_hooks() 51 { 52 $plugin_public = new WP_Swiper_Public($this->get_plugin_name(), $this->get_version()); 53 53 54 } 54 $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_frontend_assets'); 55 } 55 56 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 } 64 66 65 function enqueue_admin() { 66 wp_enqueue_style( 67 function enqueue_admin() 68 { 69 wp_enqueue_style( 67 70 $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", 69 72 array(), 70 73 '1.0.0' 71 74 ); 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 } 82 76 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 } 93 86 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 } 103 98 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 } 113 120 } -
wp-swiper/trunk/includes/public/class-wp-swiper-public.php
r3373100 r3373519 143 143 $frontend_js_path = plugin_dir_path(__DIR__) . 'build/frontend.build.js'; 144 144 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_VERSION151 );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 } 153 153 154 154 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_VERSION159 );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_VERSION166 );155 $this->plugin_name . '-bundle-css', 156 DAWPS_PLUGIN_URL . 'assets/swiper/swiper-bundle.min.css', 157 array(), 158 DAWPS_BUNDLE_VERSION 159 ); 160 161 wp_register_script( 162 $this->plugin_name . '-bundle', 163 DAWPS_PLUGIN_URL . 'assets/swiper/swiper-bundle.min.js', 164 array(), 165 DAWPS_BUNDLE_VERSION 166 ); 167 167 168 168 wp_enqueue_script( … … 175 175 $register_args = [ 176 176 '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', 178 178 'deps' => [$this->plugin_name . '-bundle'], 179 179 'ver' => DAWPS_PLUGIN_VERSION, -
wp-swiper/trunk/wp-swiper.php
r3373102 r3373519 17 17 * Plugin URI: https://digitalapps.com/wp-swiper/ 18 18 * Description: Swiper JS as a Gutenberg Block. 19 * Version: 1.3. 219 * Version: 1.3.3 20 20 * Author: Digital Apps 21 21 * Author URI: https://digitalapps.com/ … … 32 32 } 33 33 34 define( 'DAWPS_PLUGIN_VERSION', '1.3.2' ); 35 define( 'DAWPS_BUNDLE_VERSION', '11.1.14' ); 34 define( 'DAWPS_PLUGIN_VERSION', '1.3.3' ); 35 define( 'DAWPS_BUNDLE_VERSION', '12.0.2' ); 36 define( 'DAWPS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 37 define( 'DAWPS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 36 38 37 39 function activate_wpswiper() {
Note: See TracChangeset
for help on using the changeset viewer.