Skip to content

Commit d1ff654

Browse files
committed
Add update mechanism and vendor folder
1 parent cc7357e commit d1ff654

File tree

136 files changed

+12471
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+12471
-50
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#---------------------------
22
# Project
33
#---------------------------
4-
vendor/
54
node_modules/
65
.node_history
76
package-lock.json

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/).
44

5-
## [Unreleased]
5+
## [0.7.0] - 2024-12-03
6+
7+
### Added
8+
9+
- Update mechanism and vendor folder.
610

711
### Changed
812

accordion-block.php

+27-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Plugin URI: https://pixelalbatross.pt/?utm_source=wp-plugins&utm_medium=accordion-block&utm_campaign=plugin-uri
66
* Requires at least: 6.1
77
* Requires PHP: 7.4
8-
* Version: 0.6.0
8+
* Version: 0.7.0
99
* Author: Pixel Albatross
1010
* Author URI: https://pixelalbatross.pt/?utm_source=wp-plugins&utm_medium=accordion-block&utm_campaign=author-uri
1111
* License: GPL-2.0-or-later
@@ -17,12 +17,28 @@
1717
* @package pixelalbatross/accordion-block
1818
*/
1919

20+
namespace PixelAlbatross\WP\AccordionBlock;
21+
22+
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
23+
2024
// If this file is called directly, abort.
2125
if ( ! defined( 'WPINC' ) ) {
2226
die;
2327
}
2428

25-
define( 'PIXELALBATROSS_ACCORDION_BLOCK_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
29+
define( 'PIXALB_ACCORDION_BLOCK_PATH', plugin_dir_path( __FILE__ ) );
30+
31+
if ( file_exists( PIXALB_ACCORDION_BLOCK_PATH . 'vendor/autoload.php' ) ) {
32+
require_once PIXALB_ACCORDION_BLOCK_PATH . 'vendor/autoload.php';
33+
}
34+
35+
$updater = PucFactory::buildUpdateChecker(
36+
'https://github.com/pixelalbatross/accordion-block/',
37+
__FILE__,
38+
'accordion-block'
39+
);
40+
41+
$updater->setBranch( 'main' );
2642

2743
/**
2844
* Registers the block using the metadata loaded from the `block.json` file.
@@ -31,9 +47,9 @@
3147
*
3248
* @see https://developer.wordpress.org/reference/functions/register_block_type/
3349
*/
34-
function pixelalbatross_accordion_block_init() {
50+
function accordion_block_init() {
3551

36-
$block_json_files = glob( PIXELALBATROSS_ACCORDION_BLOCK_PLUGIN_PATH . 'build/*/block.json' );
52+
$block_json_files = glob( PIXALB_ACCORDION_BLOCK_PATH . 'build/*/block.json' );
3753

3854
foreach ( $block_json_files as $filename ) {
3955

@@ -45,30 +61,30 @@ function pixelalbatross_accordion_block_init() {
4561
wp_set_script_translations(
4662
$handle,
4763
'accordion-block',
48-
PIXELALBATROSS_ACCORDION_BLOCK_PLUGIN_PATH . 'languages'
64+
PIXALB_ACCORDION_BLOCK_PATH . 'languages'
4965
);
5066
}
5167
}
5268
}
5369
}
54-
add_action( 'init', 'pixelalbatross_accordion_block_init' );
70+
add_action( 'init', __NAMESPACE__ . '\accordion_block_init' );
5571

5672
/**
5773
* Registers the block textdomain.
5874
*
5975
* @return void
6076
*/
61-
function pixelalbatross_accordion_block_i18n() {
62-
load_plugin_textdomain( 'accordion-block', false, plugin_basename( PIXELALBATROSS_ACCORDION_BLOCK_PLUGIN_PATH ) . '/languages' );
77+
function accordion_block_i18n() {
78+
load_plugin_textdomain( 'accordion-block', false, plugin_basename( PIXALB_ACCORDION_BLOCK_PATH ) . '/languages' );
6379
}
64-
add_action( 'plugins_loaded', 'pixelalbatross_accordion_block_i18n' );
80+
add_action( 'plugins_loaded', __NAMESPACE__ . '\accordion_block_i18n' );
6581

6682
/**
6783
* Handles JavaScript detection.
6884
*
6985
* Adds a `js` class to the root `<html>` element when JavaScript is detected.
7086
*/
71-
function pixelalbatross_accordion_block_js_detection() {
87+
function accordion_block_js_detection() {
7288
echo "<script>!function(s){s.classList.contains('js')?s.classList:s.classList.add('js')}(document.documentElement);</script>\n";
7389
}
74-
add_action( 'wp_head', 'pixelalbatross_accordion_block_js_detection', 0 );
90+
add_action( 'wp_head', __NAMESPACE__ . '\accordion_block_js_detection', 0 );

build/accordion-item/index.asset.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '43c81634be587df37cd3');
1+
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-hooks', 'wp-i18n'), 'version' => 'a0c8afe171e52b97aa5e');

build/accordion-item/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/accordion/index.asset.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element'), 'version' => 'cb01839bb10f1c38136e');
1+
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components'), 'version' => '967261e484d11ef455fe');

build/accordion/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"autoload": {},
1616
"require": {
1717
"php": "^8.2",
18-
"composer-plugin-api": "^2.3"
18+
"composer-plugin-api": "^2.3",
19+
"yahnis-elsts/plugin-update-checker": "^5.5"
1920
},
2021
"require-dev": {
2122
"phpcompatibility/php-compatibility": "dev-develop as 9.99.99",

0 commit comments

Comments
 (0)